Posted in jquery
3
12:17 am, June 28, 2019

Change link target with JQuery

this will change the link href target to # on document load rather than its original link

HTML

<div class='nested-link alert'>
<a href='the.link.to.replace' class='btn btn-primary'>link target</a>
</div>

Javascript

$(document).ready(function() {
$('.nested-link > a').attr("href", "#");
}

View Statistics
This Week
8
This Month
31
This Year
0

No Items Found.

Add Comment
Type in a Nick Name here
 
Search Code
Search Code by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code snippits here, mostly for my reference. Also if i find a good site, i usually add it here.

Join me on Substack if you want me to send you a collection of the things i have done or found or read for the week. Or follow me on twitter if you prefer, i dont post much but i probably should!

❤👩‍💻🕹

Random Quote
"We're tight-fisted with property and money, yet think too little of wasting time, the one thing about which we should all be the toughest misers.”
Seneca