Happy Codings - Programming Code Examples
Html Css Web Design Sample Codes CPlusPlus Programming Sample Codes JavaScript Programming Sample Codes C Programming Sample Codes CSharp Programming Sample Codes Java Programming Sample Codes Php Programming Sample Codes Visual Basic Programming Sample Codes


JavaScript Programming

JavaScript > Code Examples

width(): find the width of div

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
width(): find the width of div $("div.myElements").width(500) is identical to $("div.myElements").css("width","500px") <html> <head> <title>Happy Codings :-) Javascript Examples</title> <script type="text/javascript" src="js/jquery-1.3.2.js"></script> <script type="text/javascript"> $(document).ready(function(){ alert( $("div").width()); }); </script> <style> div { width:50px; height:70px; float:left; margin:5px; background:rgb(255,140,0); cursor:pointer; } </style> </head> <body> <div></div> <div></div> </body> </html>