Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to fire an event when javascript changes a value 1

Status
Not open for further replies.

Zilflic

Programmer
Feb 23, 2005
17
US
I am using one select box to populate another through ajax. If there is only 1 option to be popuplated, I will default it to that option (which they can blank out by selecting '--none--' with an empty string value, so there are a min. of two options once the first dropdown value has been selected). The second dropdown has an onchange event. My question is how can I fire the onchange event through js. Is there an IE/FF complient event hander that does this? I would prefer not to call the functions in my ajax code becuase the function is used on 3 screens and this is the only one that needs the onchange function calls.

Code:
function popSecondDrop()
{
//ajax calls that populates the second dropdown
}

<select name=drop1" onchange="popSecondDrop()">
...
</select>

<select name=drop2" onchange="functionCall1(value);functionCall2(value);">
...
</select>
 
Change the element id to "drop2" and it works beautifully.

Thanks a lot, Adam!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top