$('li') in jQuery | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

$('li') in jQuery

$('li') in jQuery return something like [.........]. Is it an array ?

15th Sep 2019, 2:28 PM
harshit
harshit - avatar
1 Answer
+ 6
It returns an array of elements which are not jquery objects. If someone is wondering how jquery managed to add custom functions to the array for example: $("li").hide() The functions are assigned to __proto__ property var array = document.getElementsByTagName("li") array.__proto__.hide = function() { for(let a = 0; a < this.length; a++) { this[a].style.display = "none" } } array.hide()
15th Sep 2019, 3:03 PM
Toni Isotalo
Toni Isotalo - avatar