removeAttr working in FF but not in IE
I want to disable all "a" tags from a dynamically (using JavaScript) created table using jQuery.
I tried
$("ta开发者_StackOverflow社区bleId a").removeAttr("href");
$("tableId a").removeAttr("onclick");
This is working in FF but not in IE
Try neutralizing the links with a loop:
$("tableId a").each(function() {
$(this).attr('href', '#');
$(this).attr('onclick', 'javascript:void(0);');
});
Use prop. removeAttr doesn't work for inline onclick events on IE 6,7 and 8.
$("tableId a").prop("onclick", null);
IE does not support table
id's, but you can embed the table
inside a div
:
<div id=...>
<table>...</table>
</div>
精彩评论