mardi 29 avril 2014

can't assign an id value to an html input tag


Vote count:

0




I have to do something like this: http://ift.tt/S5qKzJ


The task is simple: assign an id to an input tag in html and get the value through javascript. I have done the SAME thing on my application (the code is very large, so i will not post it here!), but it does not work. I have something like:



321 <div id="old_pw_sp" class="col-xs-7">
322 <input type="password" id="current_password"/>
323 </div>


and the same js of the fiddle (whit right names of the div):



149 var crr_pw = document.getElementById("current_password").value;


but I keep gettin the error:



TypeError: document.getElementById(...) is null


If i analyze the input tag with firefox analyzer I get this:



<div id="old_pw_sp" class="col-xs-7">
<input type="password">
</div>


The id is not there, but I cannot figure out why. Can someone please help me?



asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire