You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

The problem is in escaping quotes and getting the double quotes around the final value, like we expect in HTML attributes. Here's an example of the right way to do this (thanks to John Brad):

onchange='"someFunc(this.form, \'abc\')"'

Notice here that there are single quotes surrounding the double quotes, and then the single quotes inline in the Javascript are escaped. This produces this result:

onchange="someFunc(this.form, 'abc')"
  • No labels