How to bind an event to appended element in jQuery?

Is there an event handler for selecting a particular option in a select element? (jQuery)?

  • I need a jQuery method to act as an event handler that is triggered when someone selects an option from an HTML select element. It is NOT in a form, and I need to be able to have separate handlers for specific options inside the select menu. Thanks in advance, -Luther

  • Answer:

    Indeed the change event is the one you're looking for, to get the selected option: $('select#mySelect').change(function()… $option = $(this).children(':selected'); });

Luther at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

is this function useful http://api.jquery.com/select/

CHANGE

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.