Reputation: 3653
I'm trying to change the value of expand to 0 when the DOM is ready.
I've tried different things
$('.link-comment').attr('href').find("expand=1").replaceWith('expand=0');
But it's not working. So I can I change the value of expand to 0
<a class="link-comment" href="/eventcomments/create-like/227?expand=1">
Upvotes: 0
Views: 82
Reputation: 126
Try this:
$('.link-comment').attr('href',$('.link-comment').attr('href').replace("expand=1", "expand=0"));
Upvotes: 0
Reputation: 388316
Try
$('.link-comment').filter('[href*="expand=1]"').attr('href', function(idx, href){
return href.replace('expand=1', 'expand=0')
})
Upvotes: 0