Personally, I'd use: jQuery.fn.hover_menu = function(offset, speed){ this.find('<li>').each(function(){ // 'this' is already a jQuery object (the one you attach the plugin to) var current_margin = $(this).css('marginLeft'); // 'this' needs to be wrapped in a new jQuery object });
Note which of the 'this' instances here are wrapped in $() and which are not. The first one is not as it is already a reference to the jQuery object that you will attach the plugin to. The one within each() is wrapped in a new jQuery object because otherwise it is just a regular li DOM element. Also, to get all the li elements within the initial object, I used find() instead of children(). I'm a bit foggy on what the difference is at the moment, but find works me. Joel Birch