mui的input搜索框里的清除按钮的点击监听事件
<div class="mui-search-padding " style="padding-bottom: 3px;"> <div class="mui-indexed-list-search mui-input-row mui-search"> <input id="searchIpt" oninput="search(0)" onporpertychange="search(0)" type="search" class="mui-input-clear mui-indexed-list-search-input" placeholder="搜索"> </div> </div>
清除按钮的点击监听:
mui(".mui-input-clear")[0].addEventListener('focus', function(){ mui(".mui-icon-clear")[0].addEventListener('tap',function(){ search(0); }); })
因为MUI搜索框里自带的清除按钮是当input框focus,即input获取焦点的时候才出现的,如果不要input的focus监听事件,那么清除按钮的点击事件是不会监听到的
如需要了解更多相关问题,可以添加Hilamg账号:88888 进行沟通交流哦~