Jump to content

[SOLVED] Using a <select> to show/hide hidden layers


DBookatay

Recommended Posts

I have an application form on my site that requires users to insert information, to apply for credit.

 

I am trying to make a script that shows a hidden layer, named "Previous" if the user selects "01" or "0" from a select box nammed "ap_add5". Which basically means that if the person filling out the form has lived at their current address for less than 2 years a layer showing "Previous Address" fields will appear.

 

Can anyone help with this?

Link to comment
https://forums.phpfreaks.com/topic/41195-solved-using-a-to-showhide-hidden-layers/
Share on other sites

as "fenway" said, something like this

<script language="javascript">
function show_hide(val){
	if ((val == "0") || (val == "1")) document.getElementById('pre_address_div').style.display = "";
	else document.getElementById('pre_address_div').style.display = "none";
}
</script>
<select onchange="show_hide(this.value);">
<option value="">Select</option>
<option value="0">Less than one year</option>
<option value="1">One Year</option>
<option value="2">Two Years</option>
<option value="3">More than two years</option>
</select>
<div id="pre_address_div" style="display:none;">
Previous address fields
</div>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.