penja
penja

Reputation: 1

Should we use jQuery custom selector, they are working correct?

I have created simple code

$.expr[':'].test = function(node,index){ console.log(node,index) }

and executed them

$('div:test()')

All index was 0 and I don't now why? Should use them or not ? I don't want use additional libraries

Upvotes: 0

Views: 29

Answers (1)

Andy Yong
Andy Yong

Reputation: 41

I think its supposed to be $('div:test'). When I tried it in the browser I got a variety of indices. It seems to work

example

Upvotes: 0

Related Questions