Index.js:1136 Uncaught TypeError: test[0].is is not a function

index.js:1136 Uncaught TypeError: test[0].is is not a function

Why not can call an var include id with [0] index?

var test = $('#id');



What does the element with id=“id” look like?

1 Like

You have to call the jQuery method on the jQuery object, it’s not on the element.

1 Like

Can you tell me or explain please where to use [0] index? Like i saw for form $('#id')[0].reset(); is have set after the id? But why? Why need for reset an 0 index? And others way to use?

Like I know is index in an array or something but why use in a id as have only one id so there no more? So not valid to use two id with same name then why use index?


If you want to get to the actual element or one of the native properties or methods.

// the element id attribute value

You can try logging it out to the console to better understand what $(‘selector’) give you back.


k.fn.init [div#test]
0: div#test // element, twirl it open to see native properties and methods
length: 1
__proto__: Object(0) // jQuery methods, twirl it open to see them