- $(document).ready(function(){
- $(".iconClass").click(function(){
- $("#iconSearch").html("<div class=\"btn-group\"><input type=\"search\" id=\"searchInput\"/><span id=\"searchClear\" class=\"glyphicon glyphicon-remove-circle\"></span></div>");
- });
- $("#searchClear").click(function(){
-
- $("#searchInput").val('');
- });
- });
- HTML CODE
- <div id="iconSearch">
- <i class="fa fa-2x fa-search iconClass"></i>
- <!--Text -->
- <div id="desText">
- <p>Click search icon</p>
- </div>
- </div>
When I run this code it doesn't work. I am trying to make an input whenever user click on the x button at the end of the input, the text in the input get cleared.
This is my first post sorry if i missed something.