Cannot get jQuery click handler to fire on ajax loaded element
-
23-09-2019 - |
문제
"MyParentPage.htm" uses the load function of jquery to load('myDiv.htm') //
myDiv.htm only contains:
<a href="#" class="bt-cbox">Click me</a>
I have the following in "MyParentPage.htm"
$(document).ready(function() {
$(".bt-cbox").click(function() {
alert("handler hit");
});
});
Why is the my alert not being hit
해결책
엔터프라이즈 버전을 사용하고 게시 기능을 사용하는 경우 재사용 가능한 콘텐츠라고하는 자동으로 생성되는 목록이 있습니다.이렇게하면 HTML 서식있는 텍스트 필드를 게시하거나 웹 파트를 통해 추가 할 수있는 텍스트 / HTML 스 니펫을 만들 수 있습니다.
제휴하지 않습니다 StackOverflow