Plenty of websites has input forms containing some text, that disappear when user clicks on it or enters own text.

HTML input placeholder

In past, we had to do this using JavaScript. However, today with HTML5 we can do it by simply adding one attribute to the input element. This attribute is placeholder, which takes your desired text as an argument.

Here is the code used to create the input on the image above:

<input class="search-input" type="search" name="search" placeholder="Enter your search terms...">

So simple, isn’t it? It’s time to remove some of the unnecessary JavaScript from your code!