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
jQueryHTML

Avatar of undefined
Last Comment
Chris Stanyon
ASKER CERTIFIED SOLUTION
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
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...
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

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

HTML (HyperText Markup Language) is the main markup language for creating web pages and other information to be displayed in a web browser, providing both the structure and content for what is sent from a web server through the use of tags. The current implementation of the HTML specification is HTML5.

62K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo