jquery - Why isn't .prop("selected",true) not working when .attr() or .addClass() does? -
I have a script that replaces the box by selecting a box with a set of style divisions, and with it When targeting the user clicks on the "fake" device, I am targeting the selected items like this:
targetSelect.eq (optionIndex) .prop ('selected'); optionIndex is the indicator of the selected div because it matches the hidden selection box option. For the above line "Selected" Goal Option I know that I am targeting the right one since targetSelect.eq (optionIndex) .addClass ('selected'); will add that class and set a selected attribute for targetSelect.eq (optionIndex) .attr ('selected targetSelect.prop (' selectedIndex ', optionIndex) . );
But that also does not work.
I believe this should work:
$ (' # Selectbox options'). eq (optionIndex) .prop ('selected', true); You can also try (make sure that there is no optionIndex string!):
targetSelect.val (optionIndex) < / Ex>
Comments
Post a Comment