[jQuery] Re: recursive dom walker

2009-05-07 Thread AndyCramb
I am sure I tried this before but I got it working by returning the filtered set to a var and then returning that to the function var matches = $(":input[id^=" + settings.source + "]").filter (function() { return $(this).attr("id").match(regEx); }); return mat

[jQuery] Re: recursive dom walker

2009-05-07 Thread AndyCramb
Thanks it works(returns the wrapped set and allows chaining) when I return the selector straight away from within the plugin but when I try and return a filtered set $.recurse({source:"a_1"}).setDisabled(true) it will not allow chaining and I get TypeError: $.recurse({source: "a_1"}) is undefin

[jQuery] Re: recursive dom walker

2009-05-06 Thread Eric Garside
You can return the jQuery object, but jQuery will throw undefined if you attempt to call $('.selector').recurse You'd have to call $.recurse You can implement a pretty quick fix, if you don't plan on doing much else with the function. Try: $.recurse = $.fn.recurse = function(options){ ...

[jQuery] Re: recursive dom walker

2009-05-06 Thread AndyCramb
Thanks Eric So is the only way to chain from an extended function in jQuery is to use $.fn.recurse= function(){} I cannot uses $.recurse = function() { } and return the jQuery object from within this function? Thanks andy On May 6, 3:13 pm, Eric Garside wrote: > Your "recurse" function is not

[jQuery] Re: recursive dom walker

2009-05-06 Thread Eric Garside
Your "recurse" function is not a method of the jQuery.fn object, so it can't work on elements. The line: $.recurse = function(options) { should be $.fn.recurse = function(options) { On May 6, 9:00 am, AndyCramb wrote: > I am trying to write a plugin that will eventually match a specific > st