douqiju2520 2018-07-24 22:07
浏览 55
已采纳

html Popover引用和引号错误的位置?

Im having an issue with the structure of a popover. When the popover is structured like the below, it flows as designed but Im missing an ID in the onclick function.

<td align="center"><input type="image" data-placement="left" data-toggle="popover" style="height:25px; width:25px" src="<?php echo ABSPATH; ?>/uploads/settings_icon.png" data-content='<a style="cursor: pointer;" onclick="test();">Delete</a>' ></td>

When I add the missing ID into the onclick function as mentioned, it breaks the button. Please see the below code...

<td align="center"><input type="image" data-placement="left" data-toggle="popover" style="height:25px; width:25px" src="<?php echo ABSPATH; ?>/uploads/settings_icon.png" data-content='<a style="cursor: pointer;" onclick="test(**'<?php echo $id;?>'**);">Delete</a>' ></td>

This is the outcome of the above line... Any help would be greatly appreciated.

Image here

  • 写回答

2条回答 默认 最新

  • dongliufa6380 2018-07-24 22:23
    关注

    You need to escape your quotes inside the test() function call. You're already inside some single quotes that are used for the data-content attribute you're defining. When you use your first single quote inside the test() call, you're effectively ending the data-content attribute.

    This question might help you further.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)