¡@

Home 

2014/10/16 ¤W¤È 12:08:00

jquery Programming Glossary: searchfor

get the next element with a specific class after a specific element

http://stackoverflow.com/questions/11560028/get-the-next-element-with-a-specific-class-after-a-specific-element

date' '#from date1' Code function nextInDOM _selector _subject var next getNext _subject while next.length 0 var found searchFor _selector next if found null return found next getNext next return null function getNext _subject if _subject.next .length.. null function getNext _subject if _subject.next .length 0 return _subject.next return getNext _subject.parent function searchFor _selector _subject if _subject.is _selector return _subject else var found null _subject.children .each function found.. _subject if _subject.is _selector return _subject else var found null _subject.children .each function found searchFor _selector this if found null return false return found return null will should never get here share improve this answer..

Jquery: Forget the DOM structure, just find the next element with this class

http://stackoverflow.com/questions/12873027/jquery-forget-the-dom-structure-just-find-the-next-element-with-this-class

does this. It goes like function nextInDOM _selector _subject var next getNext _subject while next.length 0 var found searchFor _selector next if found null return found next getNext next return null function getNext _subject if _subject.next .length.. null function getNext _subject if _subject.next .length 0 return _subject.next return getNext _subject.parent function searchFor _selector _subject if _subject.is _selector return _subject else var found null _subject.children .each function found.. _subject if _subject.is _selector return _subject else var found null _subject.children .each function found searchFor _selector this if found null return false return found return null will should never get here And you can call it like..