Reputation: 1591
Attempting to follow along with the example, but it doesn't seem to work. A little confused, as it is Mozilla.
Upvotes: 0
Views: 163
Reputation: 156464
As @Xaerxess mentions, you need to call the "setupButtons" function when the DOM is ready for manipulation; typically one does that by adding an event handler to the window "load" event, which happens when the page is entirely loaded (which is what the jQuery idiom $(document).ready(function(){...});
does.
Try adding this snippet to the end of your existing <script>
element to accomplish that goal using plain JavaScript, no jQuery needed:
window.onload = function() { setupButtons(); };
Another typical way of doing this is to use the element.addEventListener function; the difference is that you can add multiple event callbacks this way and they won't overwrite each other:
window.addEventListener('load', function() {
setupButtons();
}, false);
Upvotes: 2
Reputation: 28005
You didn't call setupButtons
function on page load, only defined it. If you include jQuery, add:
$(document).ready(setupButtons);
in you script tag and it'll work.
Upvotes: 0