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

39 views Asked by At

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

1

There are 1 answers

1
Andy Yong On

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