change input type when clicking JavaScript

Technology

change input type when clicking JavaScript

change the type of html form input when clicking on JavaScript, without jquery


change input type when clicking,html JavaScript
change input type when clicking,html JavaScript


Sometimes we want to change the type of the input of a form of an HTML code, in order to show the user information when they click on a form or field, wbmaster is not necessary JavaScript only with HTML code is everything, in this example we are going to change a text type input to date to enter for example the system date in a database you can see this example here below



it's that easy and it is not necessary to load jquery, we only place the following code:



<input class="fieldname" id="acom_fechanaci1" 
 name="acom_fechanaci1" onfocus="(this.type='date')" 
 placeholder="click here to go from type text to date" type="text" />



as you can see, we use onfocus from html to be able to change the type of data in an input, I hope I have helped you share this entry and see you in the next

Post a Comment

0 Comments