zoukankan      html  css  js  c++  java
  • 打开页面光标自动定位

    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 = '';
            }
    --励志成为老坛酸菜的小白菜!
  • 相关阅读:
    最近这段时间
    一元多项式的
    珍藏
    运行命令大全
    Google
    Windows Live Writer插件
    Word写论文的技
    安装Windows Live Writer后Ƃ
    比尔盖茨给人
    不经意的感悟
  • 原文地址:https://www.cnblogs.com/yongwang/p/6589594.html
Copyright © 2011-2022 走看看