0

I have a Javascript function in a separate jsp file: (used <jsp:include> for file inclusion)

function tickMembership(code){}

when invoked using onclick in an html element, the following error occurs:

Uncaught ReferenceError: tickMembership is not defined

Any idea on how this might happen? The script is there even when inspecting the sources in the browser. I am using Google Chrome.

1
  • Can you post the resulting HTML? Can you confirm the Javascript is loaded using Chrome's Developer Tools -> Network? Commented Aug 29, 2012 at 8:23

2 Answers 2

1

Attach the eventListener on load of the dom.

or if you are inserting the html dynamically you can use jquery 'on' method.

Sign up to request clarification or add additional context in comments.

1 Comment

Apparently, from the information he posted, there was nothing wrong with the event listener. The onclick event obviously fires, so the problem should lie somewhere else.
0

It is a caching issue the browser is caching the .JS file clear the browser cache and try

Happy Coding.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.