0
点赞
收藏
分享

微信扫一扫

利用 jQuery 清空 input 框

舟海君 2023-06-06 阅读 54


<span style="font-size:18px;"><span style="white-space:pre">    </span><div class="screen-window">  
        <form action="/Index/index" method="post" class="form-horizontal group-border hover-stripped">  
            <select class="control" name="clients_belong" >  
                <option value="">请选择</option>  
                <option value="1">你好</option>  
            </select>  

            <input type="text" name="timea" value=''>  
            <input type="text" name="timeb" value=''>  

            <button type="submit">确认提交</button>  
            <button id="qingkong" type="button">清空筛选</button>  
        </form>     
    </div>  

    <script src="/Public/js/jquery-1.8.3.min.js" type="text/javascript" charset="utf-8"></script>  
    <script type="text/javascript">  
        $("#qingkong").click(function(){  
            $(".screen-window form input").each(function(){  
                $(this).val('');  
            });  
            $(".screen-window form select").each(function(){  
                $(this).val('');  
            });  
        })  
    </script></span>

使用 $(this).val(''); 即可


举报

相关推荐

0 条评论