JQuery Two-level linkage plugin: jquery.selected
A page can refer to multiple linkage effects, using the method:
Configure JS:
Copy Code code as follows:
var defaults = {
Nextselid: ' #Select2 ',
Seltextid: ' #Text1 ',
Separator: '--',
Selstrset: [
{Name: ' Please choose ', SubName: ' Please choose '},
{name: ' ★ High This ★ ', SubName: ' Computer Science and Technology | Chinese language and Literature '},
{name: ' ★ High Special ★ ', SubName: ' Chinese Education | secretarial | Preschool education | Tourism Management | Legal Affairs | ECONOMIC Management | accounting Computerization | e-commerce | Computer Information management | Software Engineering | electromechanical Integration | Fine Chemicals Production Technology | Manufacturing design and Automation |-Broadcasting and Hosting | Art design, calligraphy direction art design '},
{Name: ' ★ Special Promotion ★ ', SubName: ' Ideological and political education | Chinese language and Literature | english | Mathematics and Applied Mathematics | Electronic Information Engineering | Computer Science and Technology | accounting | Public Utilities Management | Tourism Management | Physical Education | musicology | Art Design | Calligraphy direction art design '}]
}
var defaults2 = {
Nextselid: ' #Select4 ',
Seltextid: ' #Text2 ',
Separator: ' ★ ',
Selstrset: [
{Name: ' Please choose ', SubName: ' Please choose '},
{name: ' Beijing ', SubName: ' Beijing 1| Beijing 2 '},
{name: ' Shanghai ', SubName: ' Shanghai 1| Shanghai 2| Shanghai 3| Shanghai 4 '},
{name: ' Tianjin ', SubName: ' Tianjin '}]
}
Configuration Description:
Nextselid: Pull down list ID to be loaded by linkage
Seltextid: Displays the text box ID of the selection option
Separator: First level menu, Level two menu split string
Selstrset: Configure Drop-down options
[{name: ' Please choose ', SubName: ' Please choose '}]
Name: First level dropdown option; SubName: Level Two drop-down options, multiple "|" Separate
HTML page:
Copy Code code as follows:
<body>
<script type= "Text/javascript" >
$ (function () {
$ (' #Select1 '). Selected (defaults);
$ (' #Select3 '). Selected (DEFAULTS2);
});
</script>
<select id= "Select1" >
</select>
<select id= "Select2" >
</select>
<input id= "Text1" type= "text"/>
<br/>
<select id= "Select3" >
</select>
<select id= "Select4" >
</select>
<input id= "Text2" type= "text"/>
</body>
For good advice, please leave a comment!
Full JS Download Address