I'm trying to load a widget in javascript which creates a HTML table once it has been loaded. Example:
<td class="foo"><a class="bar" href="http://example.com">Example</a></td>
Inside the table are links where I'd like to remove the href attribute. So the result looks like this
<td class="foo"><a class="bar">Example</a></td>
I tried the following jQuery:
function myfunction() {
$("td a").each(function(){
if($(this).hasClass("bar")){
$(this).removeAttr("href");
}
});
};
I tried it also with onload="myFunction()" but that neither worked out.
Why this is not working? Any input is much appreciated!