javascript - Input type text not taking values even after making it editable -


hi have requirement editing fields when click on edit link.initially fields under disabled , readonly state.oncei click on edit value should blank , editable.

my problem here value changed blank , can place cursor in text box.but not taking values type. below code:

<html> <head> <style></style> <script type="text/javascript">  function editemail(){      var demo = document.getelementbyid('email');      demo.readonly = false;     demo.disabled = false;     demo.value=" ";      return false;}  function editmob(){      var demo = document.getelementbyid('mobile');      demo.readonly = false;     demo.disabled = false;     demo.value=" ";      return false;}  </script> </head> <body>     <h3>edit profile</h3><h3>${username}</h3>     <form action="/changeprofile" method="post">     <table>         <tr>             <td><label>email id</label></td>             <td><input type="text" id="email"  name="emailid" value="${emailid}" disabled readonly></td>             <td><label><a href="#email" id="aemail" onclick="editemail()">edit</a></label></td>         </tr>         <tr>             <td><label>mobile</label></td>             <td><input type="text" id="mobile" name="mobileno" value="${mobileno}" disabled readonly /></td>             <td><label><a href="#mobile" id="amobile" onclick="editmob()">edit</a></label></td>         </tr>         <tr>             <td><input type="submit" id="confirm" value="confirm" /></td>          </tr>     </table>     </form>  </body> </html> 

kindly let me know if missed in coding.

you on right track, mistake making in writing "readonly" should in camelcase readonly

eg: demo.readonly = false;

here working fiddle


Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -