Link to home
Start Free TrialLog in
Avatar of mgmhicks
mgmhicks

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mgmhicks
mgmhicks

ASKER

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...
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.