I'm trying to set something first to be set as selected
Pass
I tried
jQuery (". AtributosSort") [0]. Selectededexex = 0; and
jQuery ("AtributosSort option: first"). Attr ('selected', 'selected'); Both were discussed but when I inspect the DOM,
I am using jQuery, because I am not in any sensory mode . Can this be the problem?
When I try both attempts to get the selected values, I did not get any error in the script console
Another thing that can be relevant I can sort out options with this Loop for each selected element on the
function sorted dropdown listBit text () {// page. JQuery ("select"). Keep track of every option (function () {// selected option. var selectedValue = jQuery (this) .val (); // Sort all options of text. I can easily sort them Val JQuery (this). Html (jQuery ("Options", jQuery (this)). Sort (function (a, b) {return a.text == b.text? 0: a.text & lt; b.text? -1: 1} )); // Select an option // jQuery (this) .val (sealed value);}); } // Use jQuery via jQuery (...) jQuery (document) .ready (sortDropDownListByText); I have commented on jQuery (this) .val (selectedValue); Because I thought that this line was establishing some options as being selected and then I can not override it, but it does not make any difference.
Any thoughts? Thank you
You have tried:
jQuery ("AtributosSort Option: first-child "). Ether ("selected", true); ?
Comments
Post a Comment