简体   繁体   English

获取数据属性值

[英]Getting the data attribute value

In view page I've - 在查看页面中,我-

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

In javascript I've - 在javascript中,我已经-

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

In javascript I want to get the value popover-2 . 在javascript中,我想获取值popover-2 Using target Is there any way to get this? 使用target有什么办法可以做到这一点? I've already tried with target.text() , target.value() ; 我已经尝试了target.text()target.value() ; but not luck. 但不是运气。

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

it's an attribute.. so name the attribute. 这是一个属性..所以命名该属性。 It's not actually data. 实际上不是数据。

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

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