您好,登錄后才能下訂單哦!
這篇文章主要介紹“JavaScript怎么實現重置功能”,在日常操作中,相信很多人在JavaScript怎么實現重置功能問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”JavaScript怎么實現重置功能”的疑惑有所幫助!接下來,請跟著小編一起來學習吧!
JavaScript實現重置功能的方法:【$(document).on('click','.dealFlowSelectedBox_bntBox_left',function(){ $('.dealFlowSelectedBox_...】。
本文操作環境:windows10系統、JavaScript 1.8.5、thinkpad t480電腦。
JavaScript實現重置功能的具體代碼如下所示:
HTML代碼:
<body> <!--頭部--> <div class="mui-content"> <div class="headerBox"> <a href="javascript:history.go(-1);" class="fanhuiBnt"> <img src="../img/dealFlow/fanhui.png" /> </a> 篩選條件 </div> <div class="dealFlowSelectedBox"> <div class="dealFlowSelectedBox_title"> <em></em> <span>支付方式</span> </div> <div class="dealFlowSelectedBox_contBox"> <a href="javascript:void(0);" class="dealFlowSelectedBox_payment active"><img src="../img/dealFlow/quanbu.png" />全部</a> <a href="javascript:void(0);" class="dealFlowSelectedBox_payment "><img src="../img/signing/zhifubao.png" />支付寶收款</a> <a href="javascript:void(0);" class="dealFlowSelectedBox_payment "><img src="../img/signing/weixin.png" />微信收款</a> </div> </div> <div class="dealFlowSelectedBox_line"></div> <div class="dealFlowSelectedBox"> <div class="dealFlowSelectedBox_title"> <em></em> <span>證件資料</span> </div> <div class="dealFlowSelectedBox_contBox"> <a href="javascript:void(0);" class="dealFlowSelectedBox_certificate active">全部</a> <a href="javascript:void(0);" class="dealFlowSelectedBox_certificate ">收款成功</a> <a href="javascript:void(0);" class="dealFlowSelectedBox_certificate ">退款成功</a> <a href="javascript:void(0);" class="dealFlowSelectedBox_certificate ">收款失敗</a> </div> </div> <div class="dealFlowSelectedBox_line"></div> <div class="dealFlowSelectedBox" style="padding: 0;"> <div class="dealFlowSelectedBox_title" style="margin: 0 0.24rem;width: calc(100% - 0.24rem);"> <em></em> <span>交易時間</span> </div> <ul class="dealFlowSelectedBox_timeBox"> <li> <span>開始時間</span> <input type="text" id="starDate" name="starDate" value="" placeholder="請選擇開始日期" readonly="readonly" /> <img src="../img/index/index_xyjt.png" /> </li> <li> <span>結束時間</span> <input type="text" id="endDate" name="endDate" value="" placeholder="請選擇結束日期" readonly="readonly" /> <img src="../img/index/index_xyjt.png" /> </li> </ul> </div> <div class="dealFlowSelectedBox_bntBox"> <a href="javascript:void(0);" class="dealFlowSelectedBox_bntBox_left">重置</a> <a href="javascript:void(0);" class="dealFlowSelectedBox_bntBox_right">確定</a> </div> </div> </body>
JS代碼:
<script type="text/javascript"> $(document).on('click','.dealFlowSelectedBox_bntBox_left',function(){ $('.dealFlowSelectedBox_payment').removeClass('active'); $('.dealFlowSelectedBox_certificate').removeClass('active'); $('.dealFlowSelectedBox_payment').first().addClass('active'); $('.dealFlowSelectedBox_certificate').first().addClass('active'); $("input").val(''); }) </script>
到此,關于“JavaScript怎么實現重置功能”的學習就結束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續學習更多相關知識,請繼續關注億速云網站,小編會繼續努力為大家帶來更多實用的文章!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。