标签:Bug

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

蓝飞 蓝飞 | 时间:2013-03-03, Sun | 9,679 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);
		});
	});
}