Update:
Instead of using
$("#mySelector:selected") or
$("#mySelector:checked")
Use
$("#mySelector").filter(":selected") or
$("#mySelector").filter(":checked")
Using $("...").is(":selected") or $("...").is(":checked") works fine as well.
Reason:
If you change the selected <option>, the :selected selector still brings the initially selected one.
http://jsbin.com/nematiteba/1/edit?html,js,output
:checked has problems as well.
Update:
Instead of using
$("#mySelector:selected")or$("#mySelector:checked")Use
$("#mySelector").filter(":selected")or$("#mySelector").filter(":checked")Using
$("...").is(":selected")or$("...").is(":checked")works fine as well.Reason:
If you change the selected
<option>, the:selectedselector still brings the initially selected one.http://jsbin.com/nematiteba/1/edit?html,js,output
:checkedhas problems as well.