Skip to main content

Posts

Showing posts with the label recursion

Recursion in jQuery event

This event is attached to a set of elements: var elems = $(this).filter(function(){ ... }); How can I trigger a change event on these elements within a change event handler, but ignore the current element? elems.bind('change input', function(){ // do some stuff... // then trigger change, but not on "this", to avoid the recursion issue elems.change(); }); Basically I want ot ignore this from elems , but only in my "manual" change()-call above...

Recursively traverse object in Objective-C

I'm converting diverse JSON objects to structured objects and want to iterate over all the nodes to process each one hierarchically. JSON framework supports conversion to an NSDictionary, which I thought was unstructured. I want to recursively iterate through each item and pay respect to the structure. How would this be done with either a dictionary or generic NSOBject? Example: - (void) processParsedObject:(NSDictionary *)obj { if (atTheEndOfTheTail) { NSLog(@"Object description: %@\n\n", obj.description); } for (id object in obj) { [self processParsedObject:object]; } } Update: I asked the question more clearly here (with answer): Recursively traverse NSDictionary of unknown structure

Form XML string by recursively traversing an un-ordered list

I need a jQuery/JavaScript function to form an XML string from an un-ordered list This is the HTML <ul> <li> <input class="checktree" type="checkbox"/> <label>PhoneNumbers</label> <ul> <li> <input class="checktree" type="checkbox"/> <label>PhoneNumber</label> <ul> <li> <input class="checktree" type="checkbox"/> <label>number</label> </li> </ul> <ul> <li> <input class="checktree" type="checkbox"/> <label>type</label> </li> </ul> </li> </ul> </li> </ul> This is the code I have now NOTE: item i