noob question: get(0) doesn't work ??
I'm writing a plugin, and I simply can't get get(0) to return the first object, even though the object array is not empty .. what the hell am I doing wrong?
Take a look at this code:
- jQuery.fn.myPlugin = function(options) {
- //alert ("inside plugin");
- this.each(function() {
- var testit = jQuery(this).parent(); //OK
- // OK:
- var testA = jQuery(testit).children("someclass");
- // returns 2 elements in my case
- console.log(testA); // OK
- // Doesn't work:
- var testB = jQuery(testit).children("someclass").get(0);
- // testB is UNDEFINED?? why - should return the first element?
- console.log(testB); // undefined??
- }
- );
- };
Hope somebody can shed some light on this ..
Best regards,
Anders