Introduction to the use of each in jquery

  • 2020-03-30 00:50:30
  • OfStack

Jquery contains two each one is $(). Each one is $. Each difference is that the former is a jquery object of built-in functions, and then a is this object traversal functions commonly used in ajax to get different traverse object data in json, for example jquery's getJSON method can convenient to achieve specified in the url json files are built-in jquery calls js native eval function to parse the json text into a js object Then iterate through each global function to get the value & PI; Syntax each(data,[params],function(current item index, current item)) is also a big difference from the built-in function each, where the index is an identifier to indicate where to start the traversal, followed by the element element to specify how many elements to traverse, and the global function each heavy index is the KEY in each KEY value pair in json. In the basic jquery tutorial book, the author has written the corresponding code as an example, but has not been able to correct the parameters of the example code as follows


Related articles: