JavaScript: Novice to Ninja, 2nd Edition

I’m following JavaScript: Novice to Ninja, 2nd Edition and have got as far as p313. I’m not sure whether it’s me that’s missing something or the author, but in the second para, it says

The validateInline() function is called every time the event is triggered.

but I don’t see where we set up an event to call this function.

Good spotting. The full code for that section is found at https://github.com/spbooks/jsninja2/blob/master/Ch%208/hero/main.js

From that full code we can see that the events are assigned near the top of the code:

form.heroName.addEventListener('keyup',validateInline,false);
form.heroName.addEventListener('keyup',disableSubmit,false);

That first line isn’t mentioned in the 2nd edition of the book.

1 Like

Thanks Paul. I got that far in the book before I had to download the code and compare what I had with the “official” code. :slightly_smiling_face:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.