Home  >  Article  >  Web Front-end  >  Select label drop-down list secondary linkage cascade example code_javascript skills

Select label drop-down list secondary linkage cascade example code_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:01:171269browse

First, from the server side, bind the drop-down list, and the text naming of the second-level drop-down is added with the ID of the first-level drop-down according to certain rules.

Copy code The code is as follows:

var options=new Array();
$ (document).ready(function(){
                                                                                                                                                                                                                                                                       ='';
           });//Put the option list To the array
$('#ddlPages option:gt(0)').remove(); //Clear the drop-down
$('#ddlSubsystems').bind('change',function(){ / /Register event
var systemname=$('#ddlSubsystems option:selected').text();
for(var j=0;j                                              ddlPages').append(options[j]);
                                                                                                                                                                        
var textname=$(this).text();
var index=textname.indexOf('-' systemname);
if(index<0){
$(this).remove ();
                                                                                                                                                                     $('#ddlPages'). val(0);                                                                                                                                                                                                                                                 // The first row is selected by default
       });
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