임 현재 DIV에서 모든 입력 요소를 가져 오려고합니다.Jquery DIV 내 각 입력
$("[required]").each(function() {
});
이 코드는 required
속성을 가진 모든 요소를 반환합니다.
$(this)
그래서 내가 사업부의 ID는 다음과 같이 있어요 얻고 통해 모든 입력을 얻으려고 :
var id = $(this).attr('id');
console.log("### " + id);
console.log($("#" + id + " > :input").length);
나는 내가 좋아하는 각 항목을 사용할 수 each()
의 함수 내에서 알고
DIV 내에 4 개의 요소를 넣었을 때 0을 반환합니다 (div의 테이블도 포함).
div에서 각 입력 요소에 대해 ID를 인쇄하는 것이 가장 이상적입니다.
는 ... 내가 outsire 또는 아래와 같이 anythign을 추가하는 경우
<div id="contactAddress" required="true">
<td>Addres line 1:</td>
<td colspan="2">
<input type="text"/>
</td>
<td>Addres line 2:</td>
<td colspan="2">
<input type="text" />
</td>
</tr>
</div>
console.log($(this).html());
이 nothign 표시하지만
<div id="contactAddress" required="true">
<input type="text" />
을
업데이트하고는 테이블을 두지 보여줍니다console.log($(this).html());
를 실행?
모든 아이디어를이 아래의 div 요소 내부의 모든 입력을 찾을 수 JQuery와 모바일
당신이 ("[유형 = 텍스트] # 부모-ID 입력"). 각각이 $ 같은 것을 MENA 않습니다 사용할 수 있습니다 (function() {}); ? – rorypicko