0

The question is pretty simple: why is nither of those are working when they should? Tried in latest chrome and FF

document.addEventListener("DOMContentLoaded", function() {
  alert("window on domcontentready");
}, false);

window.onload = function() {
  alert("window on load");
}

http://jsfiddle.net/FHHgA/4/

1
  • 2
    Because you chose onLoad in jsFiddle. Change it to no wrap - in <head> Commented Feb 26, 2014 at 13:10

2 Answers 2

1

The JavaScript is loaded on onload (inside jsfiddle), so onload won't fire, because it already fired. Switch onload to no wrap - in <head>.

Sign up to request clarification or add additional context in comments.

Comments

0

Create a blank html file and paste in your js, opening the html file will show the alerts. However it doesnt seem to display the alerts in in JSFiddler.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.