Jump to content
Larry Ullman's Book Forums

Pg 253


Recommended Posts

I went to the JS errata page but it didn't work, the javascript kept loading but didn't submit my comment. So i will post the comment here.

 

On PG.253 words.js i changed from numbers to message for the script to work. Apart from that this book is awesome, i am just dieing now to be able to get javascript into my webpages.

 

// Function for setting text of an element:

function setText(elementId, message) {

'use strict';

if ( (typeof elementId == 'string')

&& (typeof message == 'string') ) {

var output = $(elementId);

if (output.textContent !== undefined) {

output.textContent = message;

} else {

output.innerText = message;

}

} // End of main IF.

} // End of setText() function.

Link to comment
Share on other sites

  • 1 month later...
 Share

×
×
  • Create New...