get href from a jquery variable

I have a var tab that consists of this on google console

<li class>
<a href="#App1" role="tab" data-toggle="tab" aria-expanded="false">Applicant 1></a>
</li>

my question is how can I get the href (#App1) to a string, I have 3 of these tabs and I need the name of the href.

thank you
mgmhicksAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chris StanyonWebDevCommented:
To get the href in general you'd use:

$('li a').attr('href');

You'll need a way to indentify which hrefs you need to get, and you haven't given enough info for us to show that.

You'll probably need to give us some more info for specific an answer, and maybe show more of your code.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mgmhicksAuthor Commented:
Hi, I tried then $(tab li a).attr('href') and it came back undefined.  Remember tab object is already
<li class>
 <a href="#App1" role="tab" data-toggle="tab" aria-expanded="false">Applicant 1></a>
 </li>

It comes from the partial code

 $('#AppWizard').bootstrapWizard({

            onTabClick: function (tab, navigation, index) {
                var myform = $(this).html;

etc...
Chris StanyonWebDevCommented:
OK.

$(tab li a).attr('href') is not a valid selected. First of all, your selector should be in quotes, and secondly, tab is not a valid html element, so it won't work.

It's possible that your script is changing the HTML, so that the href is no longer in an LI.

Like I said, we'll need to see the code - preferably in a working page. jQuery works on the generated HTML, so that's what we'd need to see.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.