简体   繁体   中英

How to get Search Form on click of search icon

This is my code

search icon for click

<span id="et_search_icon"></span>

search form

want to show this search from on click of search icon and

 <form role="search" method="get" class="et-search-form" action="run.php">
 <input type="search" class="et-search-field" />
</form>
<span class="et_close_search_field"></span>

jQuery

$('#et_search_icon').click(function(){
  $('.et-search-form').show();
});

javascript

var form = document.getElementsByClassName('et-search-form');
function clickBtn () {
    form[0].style.display = 'block';
}
<span onClick="clickBtn()" id="et_search_icon"></span>

You can do this with Jquery:

$("#et-search-form").hide();
$("#et_search_icon").click(function(){
    $("#et-search-form").show();
})

HTML: Click here

<form role="search" method="get" id="et-search-form" action="run.php">
<input type="search" class="et-search-field" />
</form>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM