Why doesn\'t the following work for me?
Because your script runs BEFORE the label exists on the page (in the DOM). Either put the script after the label, or wait until the document has fully loaded (use an OnLoad function, such as the jQuery ready() or http://www.webreference.com/programming/javascript/onloads/)
This won't work:
This will work:
This example (jsfiddle link) maintains the order (script first, then label) and uses an onLoad: