Home > Article > Web Front-end > Detailed explanation of jquery's method of operating object array elements_jquery
The code is as follows:
1. Wrong method : You cannot use the [] method to get the jquery object array, as follows:
This doesn’t work.
2. You can use jquery’s eq() method to select:
3. You can use each() method to traverse :
When each() traverses, if you use $(this), you will get a jquery object. If you use this directly, you will get a DOM object
4. DOM object array obtained by pure js code, you can use [] to obtain array elements
The last three methods are correct, and the first one is wrong. I put him first because I want to emphasize that you can’t make the same mistake again in the future. Friends, please watch carefully.