【发布时间】:2014-11-02 03:59:51
【问题描述】:
对于下面的代码,我需要使用动态生成的 ID 获取 div 的“角色”属性。
HTML:
<div id="renable0" role="0">
false
</div>
<div id="renable1" role="1">
true
</div>
<!-- THE LIST OF DIVS CONTINUES IN INCREASING INCREMENTS OF 1 -->
Javascript:
$("[id^='renable']").editInPlace({ // editInPlace is a jQuery plugin
url: 'save.php',
params: 'pos='+$(this).attr('role') // How can I get this role attribute for the clicked div?
});
【问题讨论】:
标签: javascript jquery html attr