You want:
this.value=""; // straight JS, no jQuery
or
$(this).val(''); // jQuery
With $(this).value=""
you’re assigning an empty string as the value
property of the jQuery object that wraps this
— not the value
of this
itself.
You want:
this.value=""; // straight JS, no jQuery
or
$(this).val(''); // jQuery
With $(this).value=""
you’re assigning an empty string as the value
property of the jQuery object that wraps this
— not the value
of this
itself.