Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set a default text if a input text is empty?

how can i do it with JQuery? I use the change event but if i submit or reset the form the text is not set again. I need to show a text(it is a datapicker, so i need to show a date) inside the input.

How to do it?

Thanks!

like image 479
Dail Avatar asked Oct 24 '11 06:10

Dail


1 Answers

You can do this without Javascript. Using HTML5 is easier:

<input type="text" placeholder="default text" />
like image 196
JoJo Avatar answered Nov 12 '22 10:11

JoJo