Category Archives: Jquery

anchor tag href value in jquery

By | November 25, 2019

while working on one project, we came across situation, were we want to read href value of anchor tag and url parameters value, <a href=”\details?name=jatin” class=”mainClass”>jatin nahar</a><br/> so we can read the href value anchor tag as below, $(document).ready(function() { $(“a.mainClass”).click(function( var name = $(this).attr(‘href’).split(‘=’); console.log([1]); }); });