vendredi 16 mars 2018

How do you get a value from a text field?

I suppose this should be straightforward, but I'm stuck to get that "cpsc" value. I tried to google this, and almost all of the search results told me to use ".value". But this particular class "control term" doesn't seem to work, and only returned "undefined".

<div class="control term">
     <input type="text" value="cpsc">
</div>

My code: document.getElementsByClassName("control term")[0].value;




Aucun commentaire:

Enregistrer un commentaire