我有 HTML 格式的标准联系表格:
<input type="text" class="text" value="" name="username" id="username" />
为了在发生错误时返回值,我使用了 localstorage:
$(document).ready(function() {
var item = window.localStorage.getItem('username');
$('input[name=username]').val(item);
$('input[name=username]').change(function() {
window.localStorage.setItem('username', $(this).val());
});
问题出在 Internet Explorer 中。当我第一次使用联系表单打开我的页面时,所有字段的值都名为“NULL”。有没有办法让我删除它?
谢谢