jquery how to empty input field

后端 未结 7 1841
鱼传尺愫
鱼传尺愫 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条回答
  •  野性不改
    2020-11-30 21:02

    if you hit the "back" button it usually tends to stick, what you can do is when the form is submitted clear the element then before it goes to the next page but after doing with the element what you need to.

        $('#shares').keyup(function(){
                    payment = 0;
                    calcTotal();
                    gtotal = ($('#shares').val() * 1) + payment;
                    gtotal = gtotal.toFixed(2);
                    $('#shares').val('');
                    $("p.total").html("Total Payment: " + gtotal + "");
                });
    

提交回复
热议问题