Hide HTML Button

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Aashish Dalmia
    New Member
    • Jul 2012
    • 1

    Hide HTML Button

    How to make html button hide. I tried enable and hide true/false.
  • ariful alam
    New Member
    • Jan 2011
    • 185

    #2
    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>
    hope its work for you.

    Comment

    • martin631775
      Banned
      New Member
      • Dec 2012
      • 13

      #3
      use visibility:hidd en in the css ..
      for more help.[Link removed]
      Last edited by Meetee; Jan 2 '13, 08:09 AM. Reason: Link removed

      Comment

      • sainathsagar
        New Member
        • Jan 2013
        • 7

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

        <input type="button" id="btnsubmit" style="visibili ty:hidden;">
        Last edited by acoder; Jan 5 '13, 07:15 PM.

        Comment

        • Anas Mosaad
          New Member
          • Jan 2013
          • 185

          #5
          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

          Working...