Set width of any element using JQuery

Virendradugar
Posted by Virendradugar under jQuery category on | Views : 30508
This code will set/overwrite the width of dvWidth element using JQuery. You can download the Jquery from http://docs.jquery.com/Downloading_jQuery.


<script type="text/javascript" src="Script/jquery-1.3.2.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#dvWidth").width(50);
});
</script>


<div id="dvWidth" style="width:300px">
<h1>Virendra Dugar</h1>
</div>


Find out difference between width() vs css('width') and height() vs css('height')
http://jquerybyexample.blogspot.com/2010/08/width-vs-csswidth-and-height-vs.html

Enjoy.

Comments or Responses

Login to post response