how can i merge the 开发者_StackOverflowresults of two select statments with jquery?
for example i have
var previous = $(this).prev('td');
var next = $(this).next('td');
how do i then combine the two sets of results into one?
var all = $.merge(previous, next);
Try:
var all=$(this).prev('td').add( $(this).next('td') );
You can use empty collection
var previous = $(this).prev('td'),
next = $(this).next('td'),
buttons = $().add(previous).add(next);
Example: http://jsfiddle.net/UBnMm/
Alternatively:
var buttons = $(this).prev('td').add($(this).next('td'));
I think you are looking for $(this).siblings('td')
精彩评论