Arthur Yakovlev
Arthur Yakovlev

Reputation: 9309

how get href attribute in JQuery

How i can get href attribute on JQuery on on click event Something like this:

$('.nav_step ul li').on('click', function(event){
    this.$('.nav_step ul li a').href;
});

Thanks!

Upvotes: 0

Views: 75

Answers (2)

Felix
Felix

Reputation: 38102

You can use:

$('.nav_step ul li').on('click', function(event){
    console.log($(this).find('a').attr('href'));
});

Upvotes: 1

Milind Anantwar
Milind Anantwar

Reputation: 82231

use:

$('.nav_step ul li').on('click', function(event){
alert($(this).find('a').attr('href'));
});

Upvotes: 2

Related Questions