1

I've some libraries on my website, that are using $ as variable/function. I made them separate with :

jQuery(document).ready(function ($) {
    codeThatWillUseJquery($);
});

but in fact, I think there are somethings wrong. in fact :

function codeThatWillUseJquery($)
{
    console.log($('#myId').index());
}

it returns always -1, on every element. So I think there is some incompatibility in the code.

How can I know if $('#myId').index() call the jQuery's .index() function? Is there a way?

markzzz
  • 47,390
  • 120
  • 299
  • 507

1 Answers1

2

you should use obj instanceof jQuery

please check this Check if object is a jQuery object

Community
  • 1
  • 1
Pragnesh Chauhan
  • 8,363
  • 9
  • 42
  • 53