jQuery 대화 상자를 현재 부모에 연결하고 싶습니다 (입력이 포함되어 있고 부모가 양식의 자식이기 때문에). 따라서 문제는 다음과 같습니다.
http://jsfiddle.net/pprrm4st/2/
.container
현재 요소 를 찾고 여기에 대화 상자를 첨부해야합니다.
appendTo: $(this).closest('.container'), //I thougnt $(this) would be current .element
그렇지 않으면 jQuery에게 .element
아무데도 움직이지 않도록 지시하는 방법이 있습니까?
this
해당 범위의 요소가 아니므로 this
값을 설정하는 함수 호출이 없다는 점에 유의해야 합니다.
each
루프를 사용하여 문제를 해결하는 방법은 다음과 같습니다 this
. 요소 등은 어디에 있습니까?
$(".element").each(function() {
$(this).dialog({
modal: true,
autoOpen: false,
appendTo: $(this).closest('.container'),
buttons: {
"I've read and understand this": function() {
$(this).dialog("close");
}
}
});
});
$('a').click(function(){
$(".element").dialog('open');
});
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다