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.