을 사전에 다음을 사용합니다.
$("#starting_point").parent().parent().parent().parent().find("#ending_point");
또는 .parentsUntil() (https://api.jquery.com/parentsUntil/)으로 처리하십시오. (괜찮은 해결책은 아니지만 확실하게 작동합니다.)
동적으로 생성 된 계층 구조를 모르지만 #starting_point가 #ending_point보다 "낮음"인 경우 생성 할 수 있습니다. 그 재귀 함수, 당신이 찾고있는 유형에 대한 모든 수준을 확인하십시오. 기능에 사용
// start_obj is the jQuery object you start your recursive function from
// end_type is the type of element you are looking for in the hierarchy (e.g. input[ type="text" ] in your case
function get_sibling_on_other_level(start_obj, end_type) {
var grampy = start_obj.parent().parent();
if (grampy.find(end_type).length > 0) {
return grampy.children(end_type);
} else {
// start the iteration "one level higher"
// actually you should stop at "body" level - if you did not find
// what you were looking for, then it's not in that branch of hierarchy
get_sibling_on_other_level(start_obj.parent(), end_type);
}
}
다른 jQuery를 방법 : https://api.jquery.com/children/
이 내가 당신을 want.Thank 정확히 :) – AmudhaVigneshwaran