Home  >  Article  >  Web Front-end  >  jQuery selects the select control and cannot set the selected solution_jquery

jQuery selects the select control and cannot set the selected solution_jquery

WBOY
WBOYOriginal
2016-05-16 18:20:421042browse

Solution: Put the statement of the selected option into setTimeout, for example:

Copy the code The code is as follows:

setTimeout(function() {
var selSorts = $("select[id^='" controls.selsort "']");
$.each(selSorts, function(index, sort) {
var ope = $(sort).find("option[value='" arrSort[index] "']");
if (ope.length > 0)
ope[0]. selected = true;
});
}, 1);
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn