Select tab Drop-down List level Two linkage Cascade instance code

Source: Internet
Author: User
Tags bind

  This article mainly introduces the SELECT Tag Drop-down list level Two linkage Cascade instance code, you need friends can refer to the following

First from the server side, bind the Drop-down list, the level two drop-down of the text name according to a certain rule plus the first level Drop-down ID. The code is as follows: Var options=new Array ();     $ (document). Ready (function () {       //two-level linkage         $ (' #ddlPages '). Children (' option '). each (function (i) {            options[i]= ' <option value= ' +$ (This) . val () + ' > ' +$ (This). Text () + ' </option> ';        })//SET option list into array         $ (' #ddlPages option:gt (0) '). Remove ();    //Clear dropdown         $ (' #ddlSubsystems '). Bind (' Change ', function () {       //Registration Event             var systemname=$ (' #ddlSubsystems option:selected '). Text ();             for (Var j=0;j<options.length;j++) {                $ (' #ddlPages '). Append (Options[j]);             {   //option list initial             $ (' #ddlPAges option:gt (0) '). each (function (i) {   //traversal exclusion                 var text name=$ (This). text ();                 var index=textname.indexof ('-' +systemname);                 if (index<0) {              & nbsp     $ (this). Remove ();                }else{                &NB Sp   $ (this). Text (textname.substring (0,index));                 (           });             $ (' #ddlPages '). val (0);                            //default selected first line     & nbsp  });    });  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.