This article mainly introduces the multi-choice box linkage plug-in implemented by jQuery. If you need it, you can refer to the multi-choice box linkage plug-in implemented by jQuery.
The Code is as follows:
// Use: $ (_ event_src _). autoSelect (_ reload _, reload_url );
// Use the get Method for transmission at the front endLabel attribute "name" and selectedAttribute "value"// Transmit data in json format in the background// Format: {value:"Value", text:Displayed text}(Function ($ ){$. Fn. extend ({AutoSelect: function (dest, url ){Return this. each (function (){$. SelectChange ($ (this), $ (dest), url );});},});// Reset the check box$. SelectReset = function (target ){If (target! = Null ){$. SelectReset (target. data ("nextSelect "));Target. empty ();Target. append (target. data ("defaultOpt "));}};// Load the check box$. SelectLoad = function (target, data ){$. Each (data, function (index, content ){Var option = $ (""). Attr ("value", content. value). text (content. text );Target. append (option );});};// Bind the change event$. SelectChange = function (target, dest, url ){// Bind the linkage chainTarget. data ("nextSelect", dest );// Record default option (first option)If (target. data ("defaultOpt") = null)Target. data ("defaultOpt", target. children (). first ());Dest. data ("defaultOpt", dest. children (). first ());$ (Document). ready (function (){Target. change (function (event ){Var _ target = event.tar get | window. event. srcElement;If (_ target. value! = Target. data ("defaultOpt"). attr ("value ")){$. GetJSON (url ,{"Name": _ target. name,"Value": _ target. value}, Function (data, status ){If (status = "success "){$. SelectReset (target. data ("nextSelect "));$. SelectLoad (target. data ("nextSelect"), data );}}); // The background transmits data in json format} Else {$. SelectReset (target. data ("nextSelect "));}});});};}) (JQuery );