Using jQuery, how can I clear the input text after I made a click? By default, the value remains in the input field.
For example, I have an input text and the value is <
This worked for me:
**//Click The Button**
$('#yourButton').click(function(){
**//What you want to do with your button**
//YOUR CODE COMES HERE
**//CLEAR THE INPUT**
$('#yourInput').val('');
});
So first, you select your button with jQuery:
$('#button').click(function((){ //Then you get the input element $('#input')
//Then you clear the value by adding:
.val(' '); });