How to make html button hide. I tried enable and hide true/false.
Hide HTML Button
Collapse
X
-
Tags: None
-
You can do this using Javascript. check the following code. I used 2 button here. 2nd button is hidden at the start up. when you click on 1st button, the 2nd button will show and the first button will hide. similarly when you click on 2nd button, the 1st button will show and the 2nd button will hide.
Code:<input id='btn_1' type='button' value='button 1' onclick='javascript:show_hide("btn_1","btn_2")'/> <input id='btn_2' type='button' value='button 2' style='visibility:hidden' onclick='javascript:show_hide("btn_2","btn_1")'/> <script language='javascript' type='text/javascript'> function show_hide(id2hide, id2show) { document.getElementById(id2hide).style.visibility='hidden'; document.getElementById(id2show).style.visibility='visible'; } </script>
-
-
-
There's a difference between CSS visibility and display attributes. Visibility make the object hidden but still takes place in the layout which for example might affect the printing.
I would recommend you to use display:none instead.Comment
Comment