Here is what I have, but it is not working:
if(window.width() < 1000)
document.getElementsByTagName('body')[0].id="be"
else
document.getElementsByTagName('body')[0].id="bd"
;
Please tell me what I am writing wrong. Please don’t tell other solutions, please just fix this code.
Basically, I want to give a different ID to the BODY tag of a website if the browser window size is less than 1000px.
Here you go:
Place this code at the bottom of your page:
Live demo: http://jsfiddle.net/simevidas/THqXB/