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">Appl icant 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
<li class>
<a href="#App1" role="tab" data-toggle="tab" aria-expanded="false">Appl
</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
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
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.
$(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.
ASKER
<li class>
<a href="#App1" role="tab" data-toggle="tab" aria-expanded="false">Appl
</li>
It comes from the partial code
$('#AppWizard').bootstrapW
onTabClick: function (tab, navigation, index) {
var myform = $(this).html;
etc...