How to replace element's attr href with each ? // strip url

Posted by Barlas Apaydin on Stack Overflow See other posts from Stack Overflow or by Barlas Apaydin
Published on 2012-07-06T20:23:02Z Indexed on 2014/08/20 22:20 UTC
Read the original article Hit count: 200

Filed under:
|
|
|

im trying to change href with each method,

here is demo, inspect a, you'll see there is no change

html:

<a href="#/news">News</a>
<a href="#/news/detail">Detail</a>
<a href="#/sport">Sport</a>
<a href="#/sport/football">Football</a>????????????

jQuery:

$('a').each(function() {
  $(this).attr('href').replace('#/',''); //tried to erase #/ from all hrefs
});?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about href