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

6th of November 2012 1

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
Sorry, CHANGE, this particular method appears to be an event triggered when you highlight (select) text.

Best answer:

Answer by CHANGE
is this function useful

http://api.jquery.com/select/

Know better? Leave your own answer in the comments!

Share it!

Was it good for you to?

Sponsors

Support for the site!

No sponsors at the moment.



1 great comment(s) for this post

  1. Kevin 2:46 pm 6/11 of 2012

    Indeed the change event is the one you’re looking for, to get the selected option:

    $ (‘select#mySelect’).change(function(){
    $ option = $ (this).children(‘:selected’);
    });

    Reply

Your opinion matters. Add it below.


Tip: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Recent comments

Categories



Copyright jqueryui.info since 2010. All rights reserved. Design and the Absolute Theme by Tommie Hansen.