Onfocus input change type and assign a value at the same time

Asked

Viewed 21 times

0

Hello, I have the following code.

What I have today is that by clicking on input he changes the input to date, but I would like to click it to continue changing and assign a date, I have tried to put the onfocus="(this.value='2018-06-21')" next to each other onfocus that I already have but to no avail.

<input type="text" name="dtfinal" onfocus="(this.type='date')" onfocusout="(this.type='text')" placeholder="Data Final">

1 answer

1


Just separate with a comma.

<input type="text" name="dtfinal" onfocus="(this.value = '2018-06-21', this.type='date')" onfocusout="(this.type='text')" placeholder="Data Final">

Browser other questions tagged

You are not signed in. Login or sign up in order to post.