IE8 Mode Click No response option no response solution _jquery

Source: Internet
Author: User

Think of the elementary school time countless a small thing, hey, that sunset under the run, is my lost youth ah.

Anyway, let's go ahead and figure out:

<select id= "Cardnolist" size= "4" ></select>

The effect of the implementation of a more common one, click the Select option, assign it to the above input, directly in jquery write:

Copy Code code as follows:

$ ("#cardNoList option"). Click (function () {
$ ("#card"). attr ("Value", ""). attr ("value", this.value);
})

There's a strange thing,

Because the user is basically the use of 360 browsers such as domestic dual-core browser, add a

<meta http-equiv= "x-ua-compatible" content= "ie=edge,chrome=1"/>

The native eclipse run is parsed by the chrome kernel and placed in the test environment, which becomes the IE8 standard.

Now the problem comes, learn to dig ... Uh, no!

When opened with IE8, click option without any response.

Plus alert tried the following:

Copy Code code as follows:

$ ("#cardNoList option"). Click (function () {
Alert ("111");
$ ("#card"). attr ("Value", ""). attr ("value", this.value);
Alert ("222");
})

Click Not called at all.

The first thought was the compatibility of jquery click events under the IE8, but jquery compatibility is packaged and applied so widely that I'm not supposed to encounter.

Later thought, may be under the IE8 click simply did not add to option above, changed, will click Add to select, became, IE8, Firefox, Chrome can be successfully assigned to input.

Copy Code code as follows:

$ ("#cardNoList"). Click (function () {
$ ("#card"). attr ("Value", ""). attr ("value", this.value);
})

Baidu, seemingly "well-known, in IE, select option is not support onclick event" O (╯-╰) o

By reminder, replace the following:

Copy Code code as follows:

$ ("#cardNoList"). Click (function () {
$ ("#card"). Val (This.value);
})

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.