Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 848593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:58:03+00:00 2026-05-15T06:58:03+00:00

I asked a question previously , it was answered correctly in the form I

  • 0

I asked a question previously, it was answered correctly in the form I asked it but realised now why it wasn’t working for me.

I have this code to observe multiple select menus:

$('product_options').select('select').invoke("observe","change",optchange); 

This does work – as pointed out – with static layout like this:

<html> 
  <head> 
    <title>optchange</title> 
    <script type="text/javascript" src="prototype.js"></script> 
  </head> 
  <body> 
    <div id="product_options"> 
      <select id="o0"> 
        <option>1</option> 
        <option>2</option> 
      </select> 
      <select id="o1"> 
        <option>1</option> 
        <option>2</option> 
      </select> 
      <select id="o3"> 
        <option>1</option> 
        <option>2</option> 
      </select> 
    </div> 
    <script type="text/javascript"> 
      function optchange(e) { 
        alert("optchanged"); 
      } 
      $('product_options').select('select').invoke("observe","change", optchange); 
    </script> 
  </body> 
</html> 

But in my context, making a selection in the first select menu fires of an Ajax.Updater that completely replaces the content of Select 2 – this is killing the event observer. Is there a way to fix this without having to apply a new event observer each time?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T06:58:03+00:00Added an answer on May 15, 2026 at 6:58 am

    What you’re looking for here is event bubbling – With event bubbling, you can assign just one event handler to a higher element and the browser will pass any events on its children up the chain to their parent. You would end up with something more like this:

    $('product_options').observe("change",function(event){optchange(event);});
    
    function optchange(event){
        console.log(Event.findElement(event, 'select'));
    }
    

    However, there is a bit of a gotcha here – according to this post select events don’t bubble in IE6

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question was previously asked and answered correctly, but there did not seem to
I asked this question previously: Disabling and Re-Enabling Dynamic Form Elements with JQuery but
I have seen this question asked previously but can not find a clear explanation
Yes, I realize this question was asked and answered, but I have specific questions
This title of the question may seem to be previously asked and answered but
I asked a similar question about this previously, but I did not specify that
RESOLVED: CSS Animation/Scale issue in Chrome/Webkit I asked this question previously, but I'm not
I asked a question about this previously but my database structure has changed, and
I have asked a similar question previously but it was never resolved so here
I had asked a question about this earlier, but it didn't get answered right

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.