How to set width and height dynamically using jQuery

Posted by misha-moroshko on Stack Overflow See other posts from Stack Overflow or by misha-moroshko
Published on 2010-04-27T14:31:48Z Indexed on 2010/04/27 14:33 UTC
Read the original article Hit count: 223

Filed under:
|

I would like to set the width and the height of the div element dynamically using jQuery.

I was trying to replace

<div id="mainTable" style="width:100px; height:200px;"></div>

with this:

$("#mainTable").css("width", "100");
$("#mainTable").css("height", "200");

but, it does not work for me.

Please help to understand why.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about html