Hey there, I’m working with some HTML code here
<div id="div1"></div>
I’m dynamically loading content onto this div and adjusting its width in the "success" function based on the contents
Here’s the jQuery code snippet I’m using
The data variable is an array returned from PHP and its length is 30
success: function (data) {
var data1 = data;
var w2 = (data1.length) * 100;
$("#div1").css({'width' : w2 + 'px'});
alert($("#div").width());
Unfortunately, when I alert the width, I receive a NULL value and div1 remains at the default width