How to determine whether a jquery array contains an element: First create a front-end sample file; then define a set of array data; finally use the "$.inArray("js", arr);" method to determine whether the array contains Just include an element.
The operating environment of this article: windows7 system, jquery1.2.6, Dell G3 computer.
JQuery determines whether an element is included in the array $.inArray("js", arr);
var arr = [ "xml", "html", "css", "js" ]; $.inArray("js", arr); //返回 3,
If it is not included in the array, it returns -1;
Related introduction:
jQuery is a JavaScript function library.
The jQuery library includes the following features:
HTML element selection
HTML element manipulation
CSS Operation
HTML Event Function
JavaScript Special Effects and Animation
HTML DOM traversal and modification
AJAX
Utilities
Recommended: "jquery video Tutorial》
The above is the detailed content of How to determine whether a jquery array contains an element. For more information, please follow other related articles on the PHP Chinese website!