Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-01-2012, 02:28 AM   PM User | #1
cancer10
Regular Coder

 
Join Date: Jun 2006
Location: India
Posts: 791
Thanks: 208
Thanked 2 Times in 2 Posts
cancer10 can only hope to improve
Question Getting selected dropdown text

Hi

I have 5 dropdowns on my webpage. What I want is when any of the options from any dropdowns are selected, i should be able to alert the text of it (not the value). I am trying the following code but it does not display any result.


Code:
$(document).ready(function(){

    $('select').change(function(){

         alert( $(this + '  option:selected' ).text() );

    });

});

Pls help
__________________
http://outlineme.com/cancer10
cancer10 is offline   Reply With Quote
Old 02-01-2012, 07:35 AM   PM User | #2
devnull69
Senior Coder

 
Join Date: Dec 2010
Posts: 2,245
Thanks: 10
Thanked 531 Times in 525 Posts
devnull69 will become famous soon enough
Try this
Code:
alert( $(this).find('option:selected').text() );
devnull69 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:57 PM.


Advertisement
Log in to turn off these ads.