javascript - Toggle a "hide table" button with "search" button -


i want toggle "hide table" button "search" button appears when searched table appears , disappears. both functions initiated onclick work, it's toggle. great! thanks.

<input name="search_country" id="search_country" type="text"> <input type="button" value="search" onclick="searched_country_table()"/> <input id="hide" value="hide table" type="button" onclick="hide_table()"> <div id="search_table"></div> 

i recommend using framework, example jquery

$( function(){        $("#search_table").hide();    $("#idhide").hide();        $("#idshow").click( function(event){      $("#search_table").show("slow");      $("#idshow").hide();      $("#idhide").show();    });        $("#idhide").click( function(event){      $("#search_table").hide("slow");      $("#idhide").hide();      $("#idshow").show();    });      });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>  <input name="search_country" id="search_country"  type="text">      <input id="idshow"type="button" value="search"/>       <input id="idhide" value="hide table" type="button" />        <div id="search_table">the table</div>


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -