Clear old values ​​from text field using jquery

I am looking for a way to clear old values ​​from a text field when I refresh a page using jquery. I tried this code but it did not work.

$('#flip_list_search').value = "";
+4
source share
4 answers

try it

$("#flip_list_search").val('');
+9
source

Use . val ()

$('#flip_list_search').val('');

or

$('#flip_list_search')[0].value ='';

.valueworks with native DOM $('#flip_list_search')object is jQuery object

$('#flip_list_search')[0]to get the first native DOM object

+3
source
$("input#flip_list_search","#Your_form_Id").val('');

. . #Your_form_Id - , . jQuery #Your_form_Id DOM.

+3

:

$('#flip_list_search').val("");
+1

Source: https://habr.com/ru/post/1534111/


All Articles