Explore the community Forums Lectora Lectora Questions & Answers how to apply javaScript to text box/objects? Reply To: how to apply javaScript to text box/objects?

#412648 Score: 0
Profile photo of Tim K
Tim K
Member
contributor
beginner
intermediate
advanced
friend finder
junior moderator
advocate
wise owl
curious george
Group Member
354 pts
@timk

Hi, there are several issues in both files:

You’re using unsuitable quotes in all your custom js actions and HTML extensions. These need to be replaced with real quotes, so that they look like this " or this '. Currently your quotes are like this ” ‘

In your first file “fade-up…” …

… jQuery itself is missing, so it can’t work. You’ll either have to attach it as an “Additional .js file” or link to the library that’s hosted online as you did in the 2nd file (but with real quotes).

With regards to the second file …

… You can’t define a function in a “Run javascript” action. Lectora turns the code in the action into a function so there must not be another function in it. You can define a function in an HTML extension and call it in an action.

… Your code to add an event listener to the checkboxes will be overridden by Lectoras own code for the checkboxes. You can add “On: Select/change” actions to the checkboxes if you want something to happen when the checkbox is changed.