[jQuery] Get text from selected dropdown option

2007-03-07 Thread David Duymelinck
I thought this was easy because it's easy to get the selected value from a dropdown but i ended up doing something like this $('#dropdown').change(function(){ $.log($(this).find('option').filter(':selected').text()); }); Is there another way to get the text? -- David

Re: [jQuery] Get text from selected dropdown option

2007-03-07 Thread Klaus Hartl
David Duymelinck schrieb: I thought this was easy because it's easy to get the selected value from a dropdown but i ended up doing something like this $('#dropdown').change(function(){ $.log($(this).find('option').filter(':selected').text()); }); Is there another way

Re: [jQuery] Get text from selected dropdown option

2007-03-07 Thread David Duymelinck
Klaus Hartl schreef: I can only imagine to make that a little shorter: $('#dropdown').change(function() { $.log( $('option:selected', this).text() ); }); A little is good enough for me :) thank you -- David Duymelinck [EMAIL PROTECTED]

Re: [jQuery] Get text from selected dropdown option

2007-03-07 Thread Mike Alsup
I can only imagine to make that a little shorter: $('#dropdown').change(function() { $.log( $('option:selected', this).text() ); }); I could imagine making it faster :-) $('#dropdown').change(function() { $.log(this.options[this.selectedIndex].text); });