Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can't get element
Message
De
05/03/2013 13:03:05
 
 
À
05/03/2013 12:53:09
Information générale
Forum:
Javascript
Catégorie:
JQuery
Divers
Thread ID:
01567453
Message ID:
01567468
Vues:
34
I know how to manipulate it - the problem is that I cannot get a reference to it. Note 'content' in this case is not the default context (the dom document) but a seperate html fragment and $(content).find('#trapName') returns zero results....

>You can address the element directly
>
>$("#trapName")
>
>If you want to get the value, use
>var value = $("#trapName).val();
>
>To set the value
>$("#trapName).val("New value");
>
>
>>I think there is something wrong with my understanding of JQuery (which is pretty elemental at best).
>>
>>I have a fragment of html. Jquery sees it as this:
$(content): jQuery.fn.jQuery.init[3]
>>0: h2
>>1: text
>>2: input#trapName
>>length: 3
>>__proto__: Object[0]
so I thought I could access the input element with
$(content).find('#trapName')
but it finds nothing.
>>
>>Any clues. Note this fragment is not in the DOM - but should that matter?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform