I have a
<input type="text" value="A new value">
I need a javascript method to clear the value of the textbox when the focus is on the textbox.
How can this be achieved?
To clear all the input in an HTML form, use the <input> tag with the type attribute as reset.
just get element using
function name() { document.getElementById('elementid').value = ""; }
you can call this function on onfocus event of textbox and clear the value
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With