javascript - jQuery ui Tabs get href -
I am currently using jQuery UI. I'm trying to do some tabs.
& lt; Div id = "tabs" style = "width: 18%; height: 30%; float: correct" & gt; & Lt; Ul & gt; & Lt; Li & gt; & Lt; A href = "#first" style = "font-size: 9 pixels; text-align: center;" & Gt; My_Fast & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "# seconds" style = "font-size: 9px; text-align: center;" & Gt; MySecond & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "# third" style = "font-size: 9px; text-line: center;" & Gt; My_third & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "# fourth" style = "font-size: 9px; text-align: center;" & Gt; My_fathth & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Div & gt;
.. and this is work.
But now, I want to: When I click on a tab:
Alert (on the "+ href" tab of the "You click the tab");
< P> How can I do this? // Change $ ("# Tab"). Tab ({Activate: Function () {console.log ($ ( "# Tabs"). Tab (/ * ?? * /)); // ATM is not working}});
I'm sure this is very easy. < / P>
Ty!
>
you newTab
> Use new tabs using property ui You can do this by:
$ ("tab ({activate: function (e, ui) {console.log (ui.newTab.find (" a "). Attr (" = "snippet-code snippet-current-hidden"> < Code> $ ("# tab") tab ({active: function (e, ui) {console.log (ui.newTab.find ("a"). Attr ("href"))}}); < / Code>
& lt; Link href = "https://code.jquery.com/ui/1.12.1/themes/ui-lightness/jquery-ui.css" rel = "stylesheet" /> & Lt; Script src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js" & gt; & Lt; / Script & gt; & Lt; Script src = "https://code.jquery.com/ui/1.12.1/jquery-ui.min.js" & gt; & Lt; / Script & gt; & Lt; Div id = "tabs" style = "width: 18%; height: 30%; float: correct" & gt; & Lt; Ul & gt; & Lt; Li & gt; & Lt; A href = "first" style = "font-size: 9px; text-align: center;" & Gt; My_first & lieutenant; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "second" style = "font-size: 9px; text-align: center;" & Gt; My_second & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "third" style = "font-size: 9px; text-align: center;" & Gt; My_third & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "fourth" style = "font-size: 9px; text-align: center;" & Gt; My_fathth & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Div & gt;
Comments
Post a Comment