In jquery, hide is not valid for option under IE

Source: Internet
Author: User

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!

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.