Jump to content
Larry Ullman's Book Forums
Sign in to follow this  

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.

Share this post

Link to post
Share on other sites

Did you get this to work, it seems your post is more of a solution than a question? I also ran across this and noticed numbers was not a parameter of the function and wondered where it came from. Let me know if you still have any issues with it though.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...