Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Event handling
Message
 
 
À
30/10/2013 14:13:57
James Blackburn
Qualty Design Systems, Inc.
Kuna, Idaho, États-Unis
Information générale
Forum:
Javascript
Catégorie:
JQuery
Titre:
Divers
Thread ID:
01586772
Message ID:
01586846
Vues:
19
Thank you for clarifying. So far the target for this project is desktop browser and tablet browser (like iPad); so I am not using JQM.

>I didn't mean mobile web site I meant using the "jquery mobile" framework. The JQM framework uses ajax almost exclusively for navigation and for each page navigated to, the html is injected in a designated div thus none of the header code that is normally associated with a web page will be rendered. For example, anything withing the head tags will be stripped out so will never run so "ready" will never run. There are numerous events programmed into the framework to allow for manipulation as the ajax loads such as pageinit, pagebeforeshow.... These events are all hooked up using on or delegate events so they are active event if the page has in not completely loaded.
>
>Don't let Ajax scare you off. It is not that hard to do in Jquery and it really makes a web app seem much faster and more user friendly if used correctly.
>
>Hope this helps.
>
>>I didn't realize that ready() should not be used in Mobile applications. Can I ask you why? Does it mean that when you run a page on iPhone browser the Ready() will not work?
>>I don't use Ajax yet at all. So at this point the "replacing the button using code snippets" goes over my head; unfortunately.
>>Thank you for your input.
>>
>>>Not to confuse you, there are other options using Jquery. This binds the click event to your button ready to use even if the button had not been created in the dom yet. I give this example in case you ever get into Jquery Mobile because use ready() is a big no no. Also, if you are using a lot of Ajax and replacing the button using code snippets, the click event using bind will be lost but using on the click event says in tact.
>>>
>>>
>>><script type=”text/javascript” >
>>>    $(document).on('click',‘#btnTest’,function () {
>>>           Alert(‘ Button clicked’ )
>>>      }) ;
>>>
>>></script>
>>>
>>>
>>>
>>>
>>>>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?
"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