Exploring Javascript (and coming from the Java world). I have the following line of code in a script:
if (jQuery) {
document.getElementById("BOTTOM_MID").innerHTML
= "JQuery Loaded - " + getTime();
}
but it does not work. BOTTOM_MID
is not initialized. Yet, the following works:
if (jQuery) {
document.getElementById("BOTTOM_MID").innerHTML
= "JQuery Loaded";
}
Doesn't Javascript understand string construction by concatenation? If yes, how should I proceed?
getTime()
is a method of theDate
object. Try this:Since you're using jQuery, I also suggest that you use jQuery's
ready()
handler and selectors:Here's a working fiddle.