Is there a way to tell Firefox not to remember the state of my input fields on page refresh?

后端 未结 4 1623
逝去的感伤
逝去的感伤 2021-02-07 00:21

Firefox has a very annoying feature. It remembers the state of input fields when you hit F5. It\'s not just the value, it remembers even whether the input is disabled or not.

相关标签:
4条回答
  • 2021-02-07 00:34

    try this:

    <a href="javascript:void(0)" onclick="javascript: $('input').attr('disabled', true); return false; " >Disable text box</a>
    
    0 讨论(0)
  • 2021-02-07 00:46

    Based on the scripting language you are using, you may try to disable caching.

    0 讨论(0)
  • 2021-02-07 00:50

    You can set the element or the form to autocomplete="off" to disable state preservation, but that also disables input autocomplete, of course.

    0 讨论(0)
  • 2021-02-07 00:51

    I do think all browsers have that feature.

    But to reset your input to its original value, try this.

    $('document').ready(function(){//or whenever you want to fire back to the default value
        $('input#withanidplease').val($('input#withanidplease').prop('defaultValue'))
    })
    
    0 讨论(0)
提交回复
热议问题