Reputation: 454
I have the following javascript function:
function Msg(strMsg){
alert(strMsg);
}
i have the following button to call the function:
<a class="btn btn-danger" onclick="Msg('a"a');" role="button">Msg</a>
but since the strMsg
passed param has a special character (") the function is not called.
The result should be: a"a
Upvotes: 1
Views: 190
Reputation: 6939
Use Escape character :
\"
Insert a double quote character in the text at this point.
<a class="btn btn-danger" onclick="Msg('a\"a');" role="button">Msg</a>
You can try something with unicode :
<a class="btn btn-danger" onclick="Msg('a"a');" role="button">Msg</a>
Upvotes: 2