Bootstrap Tutorial - Click to enlarge button








The following code shows how to click to enlarge button.

Example

<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-1.8.3.js'></script>
<link rel="stylesheet" type="text/css"
  href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.1.0/css/bootstrap.min.css">
<script type='text/javascript'>
$(window).load(function(){<!--from ww w .ja  va2 s  . c  o  m-->
    $('button').click(function() {
        var width = $(this).css('width');
        var height = $(this).css('height');

        $(this).html('Hello, World!');
        var newWidth = $(this).css('width');
        $(this).css({'width': width, 'height': height});
        $(this).animate({'width': newWidth}, 1000);
    });
});
</script>
</head>
<body style='margin:30px'>
  <button class='btn'>Hello</button>
</body>
</html>

Click to view the demo