By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,700 Members | 1,506 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,700 IT Pros & Developers. It's quick & easy.

Hide HTML Button

P: 1
How to make html button hide. I tried enable and hide true/false.
Jul 3 '12 #1
Share this Question
Share on Google+
4 Replies

ariful alam
P: 185
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.

Expand|Select|Wrap|Line Numbers
  1. <input id='btn_1' type='button' value='button 1' onclick='javascript:show_hide("btn_1","btn_2")'/>
  2.     <input id='btn_2' type='button' value='button 2' style='visibility:hidden' onclick='javascript:show_hide("btn_2","btn_1")'/>
  4.     <script language='javascript' type='text/javascript'>
  6.         function show_hide(id2hide, id2show)
  7.         {
  8.             document.getElementById(id2hide).style.visibility='hidden';
  9.             document.getElementById(id2show).style.visibility='visible';
  10.         }
  12.     </script>
hope its work for you.
Jul 5 '12 #2

P: 13
use visibility:hidden in the css ..
for more help.[Link removed]
Jan 2 '13 #3

P: 7
You can use CSS to make button hidden or visible with the help of visibility attribute.
Example :

<input type="button" id="btnsubmit" style="visibility:hidden;">
Jan 4 '13 #4

P: 185
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.
Jan 5 '13 #5

Post your reply

Sign in to post your reply or Sign up for a free account.