Sure, I agree that Andrea's solution is far better.
I'll even update the method I use to works with the instanceof way.
On Sep 21, 7:44 pm, aHeckman wrote:
> Mickael, I'd use Andrea's solution instead for the same reasons: any
> object could have an .is() method.
>
> On Sep 19, 5:16 am, Mickael
Mickael, I'd use Andrea's solution instead for the same reasons: any
object could have an .is() method.
On Sep 19, 5:16 am, Mickael DANIEL wrote:
> Hello there,
>
> In my current project, I have a similar need to detect if a variable
> is a jQuery object or not.
>
> I finaly decided to add a $.i
Hello there,
In my current project, I have a similar need to detect if a variable
is a jQuery object or not.
I finaly decided to add a $.isJQuery() method to jQuery namespace that
could acts like a regular $.isArray or $.isFunction.
Not sure, this is the best way to do this but I used something
On Thu, Sep 17, 2009 at 7:04 PM, Nico wrote:
>
> Would it be possible to add something so we could get a true with this
> example :
>
> $([]).constructor === jQuery
>
>
if you rely in such example, your solution is then:
if($([]) instanceof jQuery){
// jQuery stuff
}
which is true as long a
if ( obj.jquery )
//obj is an jQuery object
jquery property gives the jQuery version, that is always an non empty
string
On Sep 18, 1:50 am, lrbabe wrote:
> mmmh... overwriting the constructor property doesn't sound like a
> great idea to me.
> What about all the code that has been written b
mmmh... overwriting the constructor property doesn't sound like a
great idea to me.
What about all the code that has been written by developers expecting
the constructor to be what it is supposed to be: Object
You could use other particular properties of any jQuery object: they
are not arrays but