How can I remove text from a static URL inside a loaded document. For example.. I have..
<a href="mylink.html#something">My Link</a>
How can I remove #something from that href using jQuery? So it would then display as..
<a href="mylink.html">My Link</a>
Also if it helps.. I can’t remove anything containing # because what I am doing is adding another hashtag in place of it. The problem is I am getting a result like the following…
<a href="mylink.html#something#somethingelse>My Link</a>
EDIT
My jQuery…
$('ul li a').each(function () {
$(this).prop("href", $(this).prop("href") + "#something");
});
What I would like to do..
$('ul li a').each(function () {
//remove #something from href if it is already there and replace with #somethingelse
$(this).prop("href", $(this).prop("href") + "#something");
});
@VisioN .. Thanks for your help. But this is what I was looking for.