Foreground: drop-down list and to select the drop-down items are passed through the background, I use string concatenation is very low method of implementation;
A drop-down box plus a default option on the first one similar to "none" or "Please select";
Two return values in the background are placed in a custom attribute of option;
Three things to choose in the first option to take out the judgment can be;
Four with jquery each traversal
function Selecttrue () {
var a =[];
var i = 0
$ (". Wuoption"). each (function () {//option
A.push ($ (this). attr (' data_s '))
});
$ (". Gzselect"). each (function () { //select uses the class to get the name of all the people calling this class.
$ (this). Find ("option[value=" "+a[i]+" "]"). attr ("selected", true)
i++
});
}
Selecttrue ();
The number of drop-down boxes has one or more all need to traverse two times
jquery selects the drop-down box option value based on the background return value