First of all, bind the drop -down list from the server side, and the TEXT naming of the second -level drop -down is added to the ID of the first level of pulling down in accordance with certain rules.
Copy code code as follows:
var options = new array ();
$ (docume) .Ready (function () {{) {
// Two -level linkage
$ ('#DDLPAGES'). Children ('Option'). Each (function (i) {
options [i] = '<option value = "'+$ (this) .Val ()+'">'+$ (this) .text ()+'</option>';
}); // Put the Option list into the array
$ ('#DDLPAGES OPTION: GT (0)'). Remove (); //
$ ('#ddlsubsystems'). Bind ('Change', Function () {// Register event
var systemname = $ ('#DDLSubsystems Option: selectd'). Text ();
for (var j = 0; j <options.length; j ++) {
$ ('#DDLPAGES'). Append (Options [J]);
} // Option list first initialization
$ ('#DDLPAGES OPTION: GT (0)'). Each (function (i) {// Traversing
var textName = $ (this) .text ();
var index = textname.indexof ('-'+SystemName);
if (index <0) {
$ (this) .remove ();
} Else {
$ (this) .text (textname.substring (0, index));
}
});
$ ('#ddlpages'). Val (0); // Select the first line by default
});
});