js中出现missing ) after argument list

我在JS 中拼接html  

 var html = '<a href="#" onclick="onedit("+ row.id + ")">编辑</a>'; 

在项目中点击是后台报错 : missing ) after argument list 或者 Uncaught SyntaxError: Unexpected token }, 查了一下是拼接的串里面有特殊字符需要处理.

 正确的写法是:var html = "<a href='#' onclick=\"onedit('"+row.id+"')\">编辑</a>";

posted on 2017-01-23 14:24  aivnfjgj  阅读(388)  评论(0编辑  收藏  举报

导航