Home > Web Front-end > JS Tutorial > 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
Release: 2016-05-16 17:01:17
Original
1292 people have browsed it

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
       });
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template