Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Understanding javascript
Message
 
 
À
Tous
Information générale
Forum:
Javascript
Catégorie:
JQuery
Titre:
Understanding javascript
Divers
Thread ID:
01628679
Message ID:
01628679
Vues:
57
Do I understand that if you add an element (e.g. div of id="test") in the script section of the page, and then the page is sent back from the server (posted back) this element no longer exists? That is, I cannot use this element in the IF statement of the javascript?

For example, I want to call a certain method of the page but only One Time. And I was doing the following (which does not seem to work):
        if ($('#Test').length==0) {
               // div of ID Test does not exist.
               // create this div
               var $div = $('<div />').appendTo('body');
               $div.attr('id', 'Test');
               // Call button click method.
               document.getElementById("btnTest").click();
           }
The above seem to go into an endless loop.

Any suggestions? TIA
"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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform