{"name":"selected","type":"selector","title":":selected Selector","deprecated":null,"removed":null,"desc":"Selects all elements that are selected.","categories":["selectors/form-selectors","selectors/jquery-selector-extensions","version/1.0"],"entries":[{"return":"","signatures":{"added":"1.0"},"examples":{"desc":"Attaches a change event to the select that gets the text for each selected option and writes them in the div. It then triggers the event for the initial text draw.","code":"\n$( \"select\" )\n .change(function() {\n var str = \"\";\n $( \"select option:selected\" ).each(function() {\n str += $( this ).text() + \" \";\n });\n $( \"div\" ).text( str );\n })\n .trigger( \"change\" );\n","css":"\n div {\n color: red;\n }\n","html":"\n\n
\n"},"longdesc":"\nThe :selected selector works for <option> elements. It does not work for checkboxes or radio inputs; use :checked for them.