Skip to main content

Bug Tracker

Side navigation

#4636 closed feature (wontfix)

Opened May 08, 2009 02:55PM UTC

Closed October 29, 2010 05:23PM UTC

Another next function. either: $().nextOf() or $().verynext(sel)

Reported by: ericbojo Owned by: john
Priority: low Milestone: 1.4
Component: selector Version: 1.3.2
Keywords: traverse, next, nextOf, veryNext Cc:
Blocked by: Blocking:
Description

I think a good next function would be one that can find the Very next element that matches the selector.. For example: $("input[checkbox]").veryNext("input[checkbox]") would find only One elment that is the very next checkbox, either a Next sibling OR a descendent of a next sibling.

I think this is what people like me assume .next(sel) does, but it does not. Also Note that the "component" drop down below does not have a "traversing" item.

Why is this function needed? If I have a table of checkboxes, With the first column checkbox "enabling" the next column, it would be easier to implement with this function since the checkboxes are nested inside <tr><td> tags.

Attachments (0)
Change History (2)

Changed May 08, 2009 03:17PM UTC by ericbojo comment:1

My selectors are written wrong, I mean: $(this).veryNext("[input=checkbox]"). (this being the currently selected Checkbox: which Could also be nested) Also the "veryNext" thing would Not need to be A direct next sibling, it should go to the next element and its children and so on until it finds a match or the end of the document and return null if nothing is found.

An example of the DOM where this might be used:

<table>

<tr><td><input type="checkbox" onclick=" $(this).veryNext("[input=checkbox]").attr("disabled","");"/> </td><td><input type="checkbox"></td></tr>

<table>

Basically, checking the first checkbox would enable the 2nd checkbox..

Ignoring my obvious logical/synatax errors.

Changed October 29, 2010 05:23PM UTC by rwaldron comment:2

priority: minorlow
resolution: → wontfix
status: newclosed

$('foo').next() does this.

http://jsfiddle.net/rwaldron/WmLhE/