Setting jquery div width

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

this is how i try to set div size

$('#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
source share
1 answer

A unit of measure is required in CSS lengths, in this case most likely Pixel ( px ):

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

Source: https://habr.com/ru/post/1208909/


All Articles