jquery resolves browser compatibility issues case study _jquery

Source: Internet
Author: User

The example of this article analyzes the method that jquery solves the browser compatibility problem. Share to everyone for your reference, specific as follows:

Problem:

The Click event that triggers another control imglogin when the user presses the ENTER key when the input control named ABC

In IE document.getElementById (' abc '). Click (); Can call ABC's Click event

But not in FF.

Workaround:

You must do the following:

var evt = document.createevent ("mouseevents");
Evt.initevent ("Click", True, true);
document.getElementById ("Imglogin"). Dispatchevent (EVT);

To perform the Click event of the input control

If you pass jquery.

$ ("#abc"). KeyDown (function (e) {
  if (E.keycode = =
    $ ("#imgLogin"). Click ();
  }
});

Just so simple a few words on it, do not have to judge the browser

More interested readers of jquery-related content can view this site: "JQuery Cookie Tips Summary", "jquery table (table) Operation Tips Summary", "jquery drag-and-drop effects and tips summary", "jquery extension Techniques Summary", " jquery Common Classic Effects Summary "jquery animation and special effects usage Summary", "jquery selector usage Summary" and "jquery common Plug-ins and Usage summary"

I hope this article will help you with the jquery program design.

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.