我需要獲取帶有動態生成的ID的div的'角色'屬性。獲取帶動態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?
});