[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 212
  • Last Modified:

jquery event

Hi Experts,

I would ask how to set and catch tab click even using jquery.
Need working example.

Thanks a lot.
0
fpoyavo
Asked:
fpoyavo
1 Solution
 
Rainer JeschorCommented:
Hi,
what type of tab are you refering to?
A jQuery UI tab or the tab of the browser?
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
try this:

<body>
<input type="text" id="myInput">
<script type="text/javascript">
    var myInput = document.getElementById("myInput");
    if(myInput.addEventListener ) {
        myInput.addEventListener('keydown',this.keyHandler,false);
    } else if(myInput.attachEvent ) {
        myInput.attachEvent('onkeydown',this.keyHandler); /* damn IE hack */
    }

    function keyHandler(e) {
        var TABKEY = 9;
        if(e.keyCode == TABKEY) {
            this.value += "    ";
            if(e.preventDefault) {
                e.preventDefault();
            }
            return false;
        }
    }
</script>
</body>

Open in new window

0
 
fpoyavoAuthor Commented:
Big_Daddy

I asked for jquery tabs click event not TAB key on keyboard.

Thanks.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
nothing in your original question do you mention jQuery tabs, please be more specific when you're asking questions...

try this:
 $("#tabName" ).tabs({                                                                  
            activate:function(event,ui){                                                       
                            alert(ui.index);                                                   
                    }                                                                          
         });   

Open in new window


this will work for jquery ui 1.10.* or higher
0
 
RobOwner (Aidellio)Commented:
I've requested that this question be closed as follows:

Accepted answer: 500 points for The_Big_Daddy's comment #a39606705

for the following reason:

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
 
fpoyavoAuthor Commented:
So why the heck I canot post new questions ? Why you charge me and blocking from asking ?
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now