Reputation: 2783
<input id="myID" onClick="CheckAll('A','B');" />
In the project,the above code need to be put into String(see 2nd snippet). However, the CheckAll() is already inside the single quote. If two parameters are inside Single quote in checkAll() like 2nd code snippet, the checkAll() won't work.
How to fix the 2nd code snippet?
Thanks in advance and any help will be really appreciated!
$string ="<input id='myID' onClick='CheckAll('A','B');' />"
Upvotes: 3
Views: 11294
Reputation: 4023
Alternatively
$string = '<input id="myID" onClick="CheckAll(\'A\',\'B\');" />';
Upvotes: 0
Reputation: 50982
$string ="<input id='myID' onClick=\"CheckAll('A','B');\" />"
add escaping slashes
Upvotes: 1
Reputation: 4006
You can use backslash:
$string ="<input id=\"myID\" onClick=\"CheckAll('A','B');\" />"
Upvotes: 11