[英]Escape single quote ( ' ) in jquery.
I'm using the code below to send some data through a function "populate", arguments may contain single quotes or double quotes inside. 我正在使用下面的代码通过函数“populate”发送一些数据,参数可能包含单引号或双引号。 now please help me out here..
现在请帮帮我..
.attr('onclick', "populate('" + res.data[i].title + "','" + res.data[i].content + "','" + res.data[i].id + "')")
What you want to do is this: 你想要做的是:
.attr('onclick', function() {
populate(res.data[i].title, res.data[i].content, res.data[i].id)
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.