繁体   English   中英

获取数据属性值

[英]Getting the data attribute value

在查看页面中,我-

<button type="button" class="btn-highlight" data-next-popover-id="popover-2">Some Button</button>

在javascript中,我已经-

target = $('#' + currentPopoverId.data('next-popover-id'));
target.popover('show');

在javascript中,我想获取值popover-2 使用target有什么办法可以做到这一点? 我已经尝试了target.text()target.value() ; 但不是运气。

target = $('#' + currentPopoverId.attr('data-next-popover-id'));

这是一个属性..所以命名该属性。 实际上不是数据。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM