Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一系列用户可以填写的文本字段和文本框,然后单击发送。如果他点击后退按钮,我希望这些字段为空。目前,当用户单击返回时,这些字段将填充提交之前输入的数据。
是否有适用于(几乎)所有浏览器的解决方案?
在页面加载时,遍历所有输入并将其值设置为空字符串。不过,真的,有充分的理由对您的用户这样做吗?为了方便起见,这更像是浏览器功能,而不是网站功能。
$('input[type=text]').each(function(input){ input.value=""; });