Solved

Show DIV based on onSelect event handler

Posted on 2006-06-09
1
1,839 Views
Last Modified: 2012-08-14
I'm trying to show and hide DIVs based on the onSelect event handler, but it's not working.

This is my javascript:

function showDiv(divID) {
document.getElementById(divID).style.display = 'block';
}

And this is my HTML:

Type of payment account:
      <select name="paymentAccountType" onchange="showDiv(this);" >
      <option></option>
      <option>Credit card</option>
      <option>Debit card</option>
      <option>EFT</option>
      </select>

<div id="EFT" style="display:none;">EFT</div>
<div id="credit" style="display:none;">Credit card</div>
<div id="debit" style="display:none;">Debit card</div>
0
Comment
Question by:mariita
1 Comment
 
LVL 5

Accepted Solution

by:
shaggy_the_sheep earned 250 total points
ID: 16872867
Hi

Change your select box to this:

Type of payment account:
     <select name="paymentAccountType" onchange="showDiv(this.value);" >
     <option></option>
     <option value="credit">Credit card</option>
     <option value="debit">Debit card</option>
     <option value="eft">EFT</option>
     </select>

That should work!

Let me know if you need anything else

Richard
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to deal with the query string 8 37
Access RV042 GUI / Browser Issues 25 49
Html value of radio 14 31
Send form to asp server side 6 12
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question