删除图标投入使用CSS和jQuery [英] remove icon for input with css and jquery

查看:168
本文介绍了删除图标投入使用CSS和jQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图得到这个工作,但事实并非如此。

I am trying to get this to work but it doesn't.

我已删除了我的code为清理和这里是的jsfiddle code

I have removed my code for cleanup and here is the jsfiddle code

我想创建删除按钮,消除输入,也将把搜索列表

I am trying to create the remove button that removes the input and also resets the search list

 -----------------------
|                  | x | <- remove icon inside the input box
 -----------------------     
or 
 ----------------------- ----------
|                      | | All    |  <- all button outside the input box
 ----------------------- ----------

我不能设法得到了code的工作例如重置搜索结果

I can't manage to get the code to work e.g. reset the search results

推荐答案

不知道这是你在找什么...

Not sure it is what you are looking for...

使用HTML5输入类型的搜索:

Use HTML5 input type search:

<input class="search clearable" type="search" id="input"/>

然后,添加处理程序点击输入:

Then add handler click for input:

$('#input').on('click',function(){
        if(this.value === "" ) //case when user reset the input by clicking button
            $(this).keyup();
    });

演示

这篇关于删除图标投入使用CSS和jQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆