I am accessing links on a webpage with jQuery, with the following code:
$('a[href]').each(function() {
$(this).attr('class', 'visited');
$(this).attr('href', '#');
})
The class on the link will be changed, but the href will not. Is there something preventing me from changing/altering the href?
Edit:
I updated the code to the following:
$('a[href]').each(function() {
$(this).addClass('visited');
this.href = '#';
})
However, although it works on MOST websites, it doesn't work on news.yahoo.com. Any reasons why this is so?