Posted in jquery
126
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

Change link target with JQuery Demo

View Demo Full Screen View Demo New Tab

Change link target with JQuery Code

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", "#");
}

Related Tags

No Items Found.

Add Comment
Type in a Nick Name here
 
Related Search Terms