JQuery Easyui Combobox Implementation of the provincial and municipal level two linkage menu

Source: Internet
Author: User

Edit modified or new page linkage can be written like this


JQuery (function () {///provincial $ (' #province '). ComboBox ({valuefield: ' itemvalue ',//Value field TextField: ' Itemtext ',//Field displayed U RL: '/user/sort/province_list ', panelheight: ' Auto ', required:true, editable:true,//not editable, only select value: ' ${user.prov    Ince} ', Onchange:function (province) {//$ (' #city '). ComboBox (' Clear '); $ (' #city '). ComboBox ({valuefield: ' itemvalue ',//Value field TextField: ' Itemtext ',//field URL displayed: '/user/sort/city_list?provi    Nce= ' +province, panelheight: ' Auto ', required:true, editable:true,//not editable, only select value: '--Please select--'} '; });//County City $ (' #city '). ComboBox ({valuefield: ' itemvalue ',//Value field TextField: ' Itemtext ',//Field URL: '/user/sort/cit Y_list?province=${user.province} ', Panelheight: ' Auto ', required:true, editable:true,//not editable, only select value: ' ${user. City}); /Forms table           <tr>             <td align= "right" > Area Provincial </td>            <td align= "left" >                     <input type= "text" id= "province" Name= "province" style= "width: 128px "                      class=" Easyui-validatebox "validtype=" selectvalid["--Please Choose--" "/>             </td>        </tr>         < tr>            <td align= "right" > area   County City </td>             <td align= "left" >                    <input type= "text" id= "City" Name= "City" style= " width:128px "                 &nBsp    class= "Easyui-validatebox" validtype= "selectvalid["---Please choose--'] "/>            </td>        </tr>

The view page can be written like this

JQuery (function () {///provincial $ (' #province '). ComboBox ({valuefield: ' itemvalue ',//Value field TextField: ' Itemtext ',//Field displayed U RL: '/user/sort/province_list ', panelheight: ' Auto ', required:true, editable:false,//not editable, only select value: ' ${user.pro Vince});//County City $ (' #city '). ComboBox ({valuefield: ' itemvalue ',//Value field TextField: ' Itemtext ',//field URL displayed: '/user/so Rt/city_list?province=${user.province} ', Panelheight: ' Auto ', required:true, editable:false,//not editable, only select value: ' ${user.city}); /Forms table    <tr>            <td align= "right" > Regional </td>            <td align= "left" >                    <input type= "text" id= "province "Name=" province "                       class= "Easyui-validatebox"Validtype= "selectvalid["---Please choose--'] "disabled=" disabled "/>             </td>        </tr>         < tr>            <td align= "right" > area   County City </td>             <td align= "left" >                    <input type= "text" id= "City" Name= "City"                        class= " Easyui-validatebox "validtype=" selectvalid["--Please Choose--" "disabled=" disabled "/>            </td>        </tr>

The above code is learning Easyui, side summary, if there are shortcomings, please understand!

Note: When linkage, it is best to set the width of the combo box, because I do not set the width of the time, the provincial linkage city, the city combo box width will be shorter and smaller, set the width

Style= "width:128px"
It's settled! I hope this brings us some help!


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.