drwu24647
2018-07-03 05:17 阅读 527

未捕获的ReferenceError:HTMLAnchorElement.onclick中未定义请求

$dd = "<a href='javascript:void(0);' id='requestsend$send_id' onClick='request($send_id,request_send);' class='post-add-icon inline-items'><button type='button' style='background: #ccc;' class='btn btn-add-frnd'  data-toggle='tooltip' title='request' data-original-title='Mark as read'>send</button></a>";

I getting like this :

Uncaught ReferenceError: request is not defined at HTMLAnchorElement.onclick

I expected this:

<a href='javascript:void(0);' id='requestsend$send_id' onClick='request("5","request_send");' class='post-add-icon inline-items'><button type='button' style='background: #ccc;' class='btn btn-add-frnd' data-toggle='tooltip' title='request' data-original-title='Mark as read'>send</button></a>

but got this:

<a href='javascript:void(0);' id='requestsend$send_id' onClick='request(5,request_send);' class='post-add-icon inline-items'><button type='button' style='background: #ccc;' class='btn btn-add-frnd' data-toggle='tooltip' title='request' data-original-title='Mark as read'>send</button></a>
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • 已采纳
    dongzhi6905 dongzhi6905 2018-07-03 10:40

    Please try this code:

     <a href='javascript:void(0);' id='requestsend$send_id' onClick='request(&#39 $send_id &#39, &#39 request_send &#39);' class='post-add-icon inline-items'><button type='button' style='background: #ccc;' class='btn btn-add-frnd' data-toggle='tooltip' title='request' data-original-title='Mark as read'>send</button></a>
    
    点赞 评论 复制链接分享

相关推荐