Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Event handling
Message
Information générale
Forum:
Javascript
Catégorie:
JQuery
Titre:
Divers
Thread ID:
01586772
Message ID:
01586775
Vues:
26
>>I want to be sure that I understand one basic concept of event handing by Javascript or jQuery correctly.
>>
>>A very simple example:
>>
>>Page has a few buttons and a few input elements. One of the buttons ID is ‘btnTest’
>>
>>Here is the script in the Head section of the page:
>>
>><script type=”text/javascript” >
>>    $(document).ready(function () {
>>          FireClickMethod();
>>    });
>>   Function FireClickMethod() {
>>       $(‘#btnTest’).click( function () {
>>           Alert(‘ Button clicked’ )
>>        })
>>    }
>></script>
>>
>>
>>Does method FireClickMethod fire when user clicks on any of the buttons? Of course I understand that jQuery will look for element ‘btnTest’ and will determine if the click was on this button. But I just wanted to understand that method files FireClickMethod() on every click or other event on the page. Do I understand this correctly?
>
>
>http://api.jquery.com/ready/

Now that I thought about the .ready() jQuery document I think I understand it better. The code above (my example) is "wired" to the click() event of a specific button. Therefore, clicks on other buttons will not fire the method. I think I create a simple demo to test my understanding.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform