How do I empty an input value with jQuery?
Solution 1:
To make values empty you can do the following:
$("#element").val('');
To get the selected value you can do:
var value = $("#element").val();
Where #element
is the id of the element you wish to select.
Solution 2:
You could try:
$('input.class').removeAttr('value');
$('#inputID').removeAttr('value');
Solution 3:
A better way is:
$("#element").val(null);
Solution 4:
Usual way to empty textbox using jquery is:
$('#txtInput').val('');
If above code is not working than please check that you are able to get the input element.
console.log($('#txtInput')); // should return element in the console.
If still facing the same problem, please post your code.