my dog learned polymorphism*
The moose likes HTML, CSS and JavaScript and the fly likes  How to enable 2nd dropdown. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark " How to enable 2nd dropdown." Watch " How to enable 2nd dropdown." New topic
Author

How to enable 2nd dropdown.

Preethi jaya
Greenhorn

Joined: Aug 18, 2008
Posts: 12
HI
I have 2 drop down list. second drop down default disable.
when i select the data from first list after that second drop down should enable.
How to enable 2nd drop down.
please give me tips.

<HTML>
<HEAD>
<script>
function testenable()
{
document.getElementById('sel').enabled = true;
}
</script>
</HEAD>
<BODY>
<select id ="sel0" onclick=testenable();>
<option>country1</option>
<option>country2</option>
</select>

<select id="sel" disabled>
<option>state1</option>
<option>state2</option>
</select>
</BODY>
</HTML>
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1




Try this.


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Preethi jaya
Greenhorn

Joined: Aug 18, 2008
Posts: 12
Thanks man. Its working fine. but i need to change the event "on click="
to list selected after that 2nd drop down should enable.Please give me tips
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Preethi jaya wrote:Thanks man. Its working fine. but i need to change the event "on click="
to list selected after that 2nd drop down should enable.Please give me tips

I don't understand what exactly you wanted. If you replace your old script with one that I provided. Its works..

What's your requirement?
Preethi jaya
Greenhorn

Joined: Aug 18, 2008
Posts: 12
now when i click the first drop down 2nd dropdown enabled thats fine.
but i want to change the on click event into onchange or selected

<select id ="sel0" onclick=enable();> into <select id ="sel0" onchange=enable();>
Preethi jaya
Greenhorn

Joined: Aug 18, 2008
Posts: 12
Thanks Sagar I got it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to enable 2nd dropdown.
 
Similar Threads
Font color in drop down menu
check Box and Drop down
Value to the textarea
!!!!....PROBLEM ...!!!! in opener window form update.
displaying error message in JSP through javascript