Hiding elements in jquery is simple, the Hide method, $ ("#example"). Hide (), basically all elements are OK, but on the IE kernel browser, the Hide method has no effect on the option options for the Drop-down box. Use CSS to increase display:none also not, finally took a solution.
The code is as follows |
Copy Code |
<select class= "Medium Bleft" name= "Pay_type" id= "Pay_type" <option value= "0" id= "S0" >-- Please select billing type--</option> <option <eq name= "fields[0][' Pay_type ']" "value=" 1 ">selected</eq> Value= "1" id= "S1" >CPC (click Mount) </option> <option <eq name= "fields[0][' Pay_type ']" value= "2" >selected</eq> value= "2" id= "S2" >CPA (by registered billing) </option> <option <eq name= "fields[0][ ' Pay_type '] "value=" 3 ">selected</eq> value=" 3 "id=" S3 ">CPM (Thousands paid by display) </option> < Option <eq name= "fields[0][' Pay_type ']" value= "4" >selected</eq> value= "4" id= "S4" > Window (Pay by window) </ Option> <option <eq name= "fields[0][' Pay_type ']" value= "5" >selected</eq> value= "5" id= " S5 ">CPA (paid by Act) </option> <option <eq name=" fields[0][' Pay_type '] "value=" 6 ">selected </eq> value= "6" id= "S6" >cps (paid by sales) </option> </select> |
When the value of another Drop-down box changes, the corresponding hidden or display related options, using Show () and Hide () method in Google, Firefox, no problem, but found in the IE kernel browser invalid.
Therefore, this approach is used:
The code is as follows |
Copy Code |
$ (" #ad_type "). Change ( function () { type_id=$ ("#ad_type"). Val (); if (type_id==19) { $ ("#softname"). Show (); $ ("#soft, #window"). Hide (); $ ("#pay_type"). Empty (). HTML (' <option value= "1" id= "S1" >CPC (by click, installation) </option>< Option value= "2" id= "S2" >CPA (by number of registrations) </option> '); }else if (type_id==18) { $ ("#softname"). Hide (); $ ("#soft, #code, #window"). Show (); $ ("#pay_type"). Empty (). HTML (' <option value= "4" id= "S4" > Play window (paid by window) </option> "); }else{ $ ("#window"). Hide (); $ ("#soft, #code"). Show (); $ ( "#pay_type"). Empty (). HTML (' <option value= 3 "id=" S3 ">cpm (per display thousand paid) </option><option value=" 5 "id=" S5 " >CPA (paid by Act) </option><option value= "6" id= "S6" >cps (paid by sales) </option> '); } }); |
This jquery method is compatible with each browser, but it's a bit dead, let's say it first!