Your Javascript code runs in a different thread with the one that renders the HTML. If you request a width immediately after adding a new code, then there will not be time in the rendering stream to relay the page so that you get the old or, possibly, intermediate width.
I'm not sure if this is the case with newer browsers, but of course the old ones were multi-tasking joint, so the page did not refresh until you explicitly stop to let it refresh.
If you use the following code, you will find that it works because a zero second pause actually allows the browser to handle the reverder event.
function show_width() { alert(jQuery("#feedback_form").css("width")); } setTimeout(show_width, 0);
Andrew Wilkinson
source share