0
Sup,我有使用jQuery获取data- *值的问题。jQuery无法获得data- *属性值,返回undefined
我的HTML代码:
<button type="button"
class="btn btn-danger"
id="{{ currency.id }}"
data-curname="{{ currency.name }}"
data-toggle="modal"
data-target="#deleteConfirm"
onclick="deleteCurConf(this.id)">
<span class="glyphicon glyphicon-remove"></span>
Delete
</button>
jQuery是:
function deleteCurConf(id) {
var curName = $('#' + id).data('curname');
console.log(curName);
}
但是控制台数收益不确定。最有趣的是,这段代码昨天正在工作,但今天它已经坏了。 有什么想法?
顺便说一句,我使用Bootstrap3和嫩枝
最后工程:)感谢的很多:)也许你知道为什么昨天这个代码工作,虽然有错误? –
no pawel..dont有任何想法:) –
好吧,没关系:)非常感谢您的帮助,抱歉,我没有足够的排名在这里为您的答案投票,所以+1在这里: ) –