标签:size div logs span can pre clear absolute 自动
1.实现打开某页面光标自动定位在input的内容区:
2.实现点击取消清除input输入内容
此为html代码
<div class="search"> <input type="search" class="search-input input_search_key" placeholder="搜索" id="in" style="padding-left:1.5rem;padding-right: 1rem;"> <span id="ospan" style="font-size:20px; position: absolute; margin:0.3rem -1.3rem; cursor: pointer" onclick="clearInput()">×</span> <a class="search-cancel" href="questionA.html">取消</a> <div class="search_suggest " id="gov_search_suggest"> <ul> </ul> </div> </div>
此为js代码:
$(document).ready(function () { $("#in").focus(); }); function clearInput() { document.getElementById(‘in‘).value = ‘‘; }
标签:size div logs span can pre clear absolute 自动
原文地址:http://www.cnblogs.com/yongwang/p/6589594.html