im próbuje zmienić href z każdej metody,Jak wymienić element attr href elementu? // pasek URL
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
});
Nie można zastąpić łańcuch do atr tak; po prostu pobierz href jako zmienną z attr jako getter, wykonaj zamianę, a następnie wypompuj ją ponownie z attr jako seter. (lubię jak eleklanty, przypuszczam, że możesz po prostu zrobić settera w jednym!). –