how to get href value in jquery? – JavaScript get href value onclick

how to get href value in jquery – Get href value of an anchor tag with JavaScript/jQuery Firstly, include the jquery CDN link on the header part.

$(document).ready(function() {
    $('#register').click(function() {
        var href = $('a').prop('href');

how to get href value in jquery?

Get href Value of Anchor Tag in jQuery. You can use the jQuery .attr() method to dynamically set or change the value of href attribute of a link or anchor tag. Example for change href jquery.

get href value jquery

var href = $(this).attr('href');

jquery get current url

var activeURL = $(location).attr('href'); //jQuery solution
var activeURL = window.location.href; // raw javascript

jquery get link href value


jQuery change href value

$("#get_new_url").attr("href", "");

getting href value in jquery

$('a').attr('href'); // gets the actual value
$('a').prop('href'); // gets the full URL always

I hope you get an idea about how to get href value in jquery?.
I would like to have feedback on my
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Also Read This 👉   Angularjs convert json string to array