[英]autocomplete='off' functionality for a div
I am using divs to hold all inputs.我正在使用 div 来保存所有输入。 When I refresh F5 in Firefox values that were entered (but not saved) remains on the form.当我在 Firefox 中刷新F5时,输入(但未保存)的值保留在表单上。
How do I force all inputs to be empty when they are really empty after page refresh?当页面刷新后所有输入真的为空时,如何强制所有输入为空?
A solution would be autocomplete='off'
, but it's good only for a form.一个解决方案是autocomplete='off'
,但它只适用于表单。
Is there a similar functionality when a div is holding the input elements?当 div 保存输入元素时是否有类似的功能?
A HTML, JavaScript or jQuery solution would be ok. HTML、JavaScript 或 jQuery 解决方案就可以了。
EDIT: Also another solution could be applying autocomplete='off' to all inputs but I think this is not an elegant solution..编辑:另一种解决方案可能是将 autocomplete='off' 应用于所有输入,但我认为这不是一个优雅的解决方案..
您可以为每个输入使用autocomplete="off"
属性。
While loading of page, just put inside the document.ready statement of jquery加载页面时,只需要放在jquery的document.ready语句中即可
$('#<form_id>')[0].reset();
Example :例子 :
<script type="javascript">
$(function() {
$('#<form_id>')[0].reset();
});
</script>
Just try this at your html page.只需在您的 html 页面上试试这个。
<div class="test_value"> Test </div>
<div class="test_value"> asdfTest </div>
<div class="test_value"> Tes asd fast </div>
<div class="test_value"> Testa dfasdf </div>
$(function(){
$('.test_value').text('');
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.