jquery get selected dropdownlist text
Posted
by mike
on Stack Overflow
See other posts from Stack Overflow
or by mike
Published on 2010-05-05T19:51:15Z
Indexed on
2010/05/05
20:08 UTC
Read the original article
Hit count: 198
jQuery
Hi How can i get the selected text on a dropdowm, ive seen examples of how to do eg $('select option:selected').text()
but looking at my code below, how can i modify it to work as the line
alert($(this).parent().text());
gets all the list items as opposed to selected text
$(document).ready(function () {
$('.mutuallyexclusive').live("click", function () {
checkedState = $(this).attr('checked');
$('.mutuallyexclusive:checked').each(function () {
$(this).attr('checked', false);
});
$(this).attr('checked', checkedState);
alert($(this).parent().text());
});
});
© Stack Overflow or respective owner