www.webdeveloper.com
Results 1 to 2 of 2

Thread: Hide drop down after a user selects an entry.

  1. #1
    Join Date
    May 2014
    Posts
    1

    Hide drop down after a user selects an entry.

    Hello,
    I am trying to hide a drop down menu after a user selects an entry from it. I am using laserfiche forms so I am not sure which type of java they are using for the language. If this is easier to accomplish in CSS I will move to that forum.

    Thanks!

  2. #2
    Join Date
    Oct 2013
    Posts
    415
    A couple of ideas for you depending on what you want "disappeared":

    Just the select:
    HTML Code:
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>disappearing select</title>
    <script>
    	function disappear(el){
    		if (el.value != ''){
    			el.style.display = 'none';
    		}
    	}
    </script>
    </head>
    <body>
    <form action="#">
    	<label for="pickNumber">Pick a number:</label> <select id="pickNumber" onblur="disappear(this)">
    		<option value="">--</option>
    		<option value="1">1</option>
    		<option value="2">2</option>
    		<option value="3">3</option>
    		<option value="4">4</option>
    	</select> 
    </form>
    </body>
    </html>
    The select and its label:
    HTML Code:
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>disappearing select</title>
    <script>
    	function disappear(el,wrapper){
    		if (el.value != ''){
    			wrapper.style.display = 'none';
    		}
    	}
    </script>
    </head>
    <body>
    <form action="#">
    <div id="numberWrapper">
    	<label for="pickNumber">Pick a number:</label> <select id="pickNumber" onblur="disappear(this,numberWrapper)">
    		<option value="">--</option>
    		<option value="1">1</option>
    		<option value="2">2</option>
    		<option value="3">3</option>
    		<option value="4">4</option>
    	</select>
    </div>
    </form>
    </body>
    </html>
    Not a fan of WYSIWYG (I assume) form builders, so how you incorporate either of these into your form is up to you.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles