jquery how to empty input field

后端 未结 7 1844
鱼传尺愫
鱼传尺愫 2020-11-30 20:11

I am in a mobile app and I use an input field in order user submit a number.

When I go back and return to the page that input field present the latest number input d

7条回答
  •  猫巷女王i
    2020-11-30 21:02

    To reset text, number, search, textarea inputs:

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

    To reset select:

    $('#select-box').prop('selectedIndex',0);
    

    To reset radio input:

    $('#radio-input').attr('checked',false);
    

    To reset file input:

    $("#file-input").val(null);
    

提交回复
热议问题