have you considered just checking for a jQuery method? seems like that
would be the cleanest, least intrusive way of doing your check, for
example:
function get_object_from_id(variable)
{
// if the param has a "attr" property (which jQuery
objects do,
// b
Well I think I am going to be going with a function as that was my
first instinct.
I see where your going with what you have however that would cause
some issue if say an int or JSON object is passed as it is going to
return that instead of an expected jQuery object. The code I end up
having is:
If all you need to do is distinguish a string from a jQuery object, and you
want to insure that future revisions of jQuery will never break your code, I
would just test for the string.
I'd also put the logic in a function even if you only use it in one place,
e.g.
// Return a jQuery object g
3 matches
Mail list logo