views:

25

answers:

1

I'm trying to set the width of a div using jquery.

this is how I'm trying to set the size of the div

$('#page').css("width",data[0]['imageWidth']);

and this is the div I'm trying to set

<div id="page">
 </div>

any help with this would be much appreciated

+1  A: 

In CSS lengths require a unit, in this case most likely Pixel (px):

$('#page').css("width",data[0]['imageWidth'] + "px");
RoToRa
Even if unit is not specified it will work.
rahul
Try to log what `data[0]['imageWidth']` contains and make sure it's correct.
reko_t
@rahul: Only if the browser has a bug.
Aaron Digulla