-2

.is() does not return an object:

$("div").children().is(".result").click(function () { ... } );

I receive the error:

Uncaught TypeError: $(...).is(...).click is not a function

Is there a function that does the same thing as .is() but returns an object instead of a boolean?

Chad
  • 1,531
  • 3
  • 20
  • 46

2 Answers2

1

.is just returns a boolean, so it can't be chained.

Docs: http://api.jquery.com/is/

nrabinowitz
  • 55,314
  • 10
  • 149
  • 165
0

Because simple $("div.result") gives you is function. So there is no need for separate is function chain.

is is simple check returns boolean docs are avaliable on: http://api.jquery.com/is/

Piotr Stapp
  • 19,392
  • 11
  • 68
  • 116