1
Imagine a single page input
text, that is, a text field in the HTML document like this: <input value="digite aqui" type="text" id="el"/>
.
But I want to insert in this text field, through Javascript, the events onBlur()
and onFocus()
.
The final code would be
<input value="digite aqui" type="text"
onblur="if(this.value == '') {this.value = 'digite aqui';}"
onfocus="if(this.value == 'digite aqui') {this.value = '';}"
/>
This script
above is an example of how I wish it to stay, contains parts of the events who would like to make the inclusion the moment they click on a button.
I wanted to include parts within a input
existing on the page, no creating this code dynamically.
So catch the onblur="if(this.value == '') {this.value = 'digite aqui';}"
, along with onfocus="if(this.value == 'digite aqui') {this.value = '';}"
and play at <input value="digite aqui" type="text" id="el"/>
Okay, someone proposes an idea of how to do this maneuver?