I am writing a plugin for jQuery, and I want to make it so that the user can transfer data to the plugin in any form. I have a problem with JSON or an array, but I am having trouble trying to determine if the data is a jQuery object.
data = $('#list li');
console.debug( $.isPlainObject(data) );
console.debug( $.isArray(data) );
console.debug( data[0].tagName == "LI" );
The last method returns true, but there is no guarantee that the user will use the tag LIfor his data, so I think I need something like this:
if ( $.isjQueryObject(data) ) { }
Does anyone know a better method?
source
share