0
可能重复:
Stop chrome from auto styling input type=search输入型=搜索 - 如何让“X”,但保持我原来的输入布局
我想补充一点,小“X”,许多搜索输入框用于清除信息,但我需要保留自己的输入背景,字体大小等任何建议该怎么办?
input type"search"
完全改变布局...
可能重复:
Stop chrome from auto styling input type=search输入型=搜索 - 如何让“X”,但保持我原来的输入布局
我想补充一点,小“X”,许多搜索输入框用于清除信息,但我需要保留自己的输入背景,字体大小等任何建议该怎么办?
input type"search"
完全改变布局...
你可以尝试用常规的文本框已被移动在它上面的图像所以不会惹的背景图像。
HTML
<div class="clearable">
<input type="text"/>
<img src="http://www.hanebutt.co.uk/uploads/content/close_x.gif" />
</div>
CSS
.clearable img {position: relative; left: -20px;}
jQuery的
$(document).ready(function() {
$('.clearable img').click(function() {
var theInput = $(this).parent().find('input');
theInput.val("");
theInput.focus();
});
});
你可以看到它在这里的行动:http://jsbin.com/afafet