Results 1 to 9 of 9
Dec 16, 2011, 19:43 #1
- Join Date
- May 2010
- Okemos, Michigan, USA
- 1 Post(s)
- 0 Thread(s)
Writing HTML in the <head></head> of a page with JS
After attaching the jQuery library, I used js to get the width of the window browser-viewport) and store that in a variable.
What I was aiming to do was write a <title></title> for the page and attach a stylesheet through <link /> using js only when the window's height was greater than 596px.
So, I wrote the following:
The content in the body is placeholder content, but the reason i kept it there was to show you all something— as it has to do with the issue I am having.
When I visit the page with just that html above, I assume both lines were written as the page has the title "attaching stylesheet in specific viewport-sizes". Why I said assume is that i can not see <link /> in the view-source.
Anyway, the problem that occurs is that all of the content in the body is gone. Meaning, nothing shows up on the page— its a blank white-page.
And, as I did, one can double-check that the placeholder-content is there normally if they just comment-out the js.
So my issues are:
1.) Is the <link /> line being written?
2.) Why is all the body's content gone? And how can i get it to say while writing the html with js in that condition?