Skip to content Skip to sidebar Skip to footer

Passing Double Quotes In JavaScript Function Parameter

I'm have trouble with the following html Works

Solution 1:

To use a " in a JavaScript " delimited string, use \".

To use a " in an HTML " delimited attribute value, use ".

Combine them if needed: \"


Alternatively, stop using intrinsic event attributes, write unobtrusive JavaScript and bind your event handlers programatically.


Solution 2:

Just escape it with a backslash \".


Solution 3:

first you should write html like:

attribute="property"

so if you write:

onclick="alert('what you want here with encoded content it will work')"

see your updated fiddler http://jsfiddle.net/darkyndy/9d43U/5/


Post a Comment for "Passing Double Quotes In JavaScript Function Parameter"