When I pass the string 2cdfdfa2-3639-4aed-bf37-9fb7ba1c936c
to a javascript function, I get syntax error in Firebug.
I have my code in a variable before inserting it into a div-tag. I print this out in the Console when I press the DeleteBookmarkFunction. Firebug says there is a syntax error in the call of the function:
<div onclick='DeleteBookmarkFunction('3fad79fb-ce54-4ceb-9b35-cfb50d5540de')'>
<a class='remove'>Slett</a>
</div>
Some of my code:
var id=data[j].UniqueID;
src += "<div id='" + data[j].UniqueID + "'></div>" ;
src += "<div onclick=\'DeleteBookmarkFunction ( \'"
src += id;
src += "\' )\'>";
src += '<a class=\'remove\'>Slett</a></div>';
What is causing Firebug to report an error?
对属性使用双引号
<div onclick="DeleteBookmarkFunction ( '3fad79fb-ce54-4ceb-9b35-cfb50d5540de' )"><a class="remove">Slett</a></div>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.