杰拉斯的博客

jQuery Bug:获取不到Chrome自动填充表单的值

杰拉斯 杰拉斯 | 时间:2013-03-03, Sun | 14,103 views
前端开发 
// Stop chrome's autocomplete from making your input fields that nasty yellow. Yuck.
if (navigator.userAgent.toLowerCase().indexOf("chrome") >= 0) {
	$(window).load(function(){
		$('input:-webkit-autofill').each(function(){
			var text = $(this).val();
			var name = $(this).attr('name');
			$(this).after(this.outerHTML).remove();
			$('input[name=' + name + ']').val(text);
		});
	});
}

如需转载请注明出处:杰拉斯的博客

相关文章

4 条评论 »

  1. 测试表明金丝雀没问题哈~ 不过我还是提交去了~

  2. 我想问一下博主 你的那条微博是怎么做成游戏的

    1. 那个是新浪微博的菜单来的。