I am trying to apply width to the 'div' as per user's screen resolution. For that I am using below jquery code:
$(function() {
var resolution = $(window).width();
var new_width = resolution - 17;
new_width = new_width + "px";
$("#box").css("width", new_width);
});
I am trying to change width dynamically but its not working.
If I give values statically by using $("#box").css("width", "500px"); it will take effect and sets the width to 500px but if I use new_width instead of 500px its not changing the width of div.
How do I fix it?