2013-07-16 4 views
0

bootstrap popover에 입력으로 사용자 정의 html을 넣었습니다. http://jsfiddle.net/53pD6/16/부트 스트랩 팝 오버 문제

<button class="btn btn-small btn-popover" type="button" data-original-title="Popover" data-placement="bottom">*</button> 

<!-- Popover html boby (Display attribute is none!) --> 
<div id="popover_content_wrapper" style="display: none"> 
    <input type="checkbox" class="chbox"/>Click me (no effect) 
</div> 

<input type="checkbox" class="chbox"/>Click me (here it's Ok) 

그리고 JS : 지금은 자바 스크립트를 사용하여 이러한 입력을 바인딩 할,하지만 난 그래서

... 그것을 할 수 없습니다, 여기에 더 명확하게 내 문제를 설명 할 수있는 간단한 예입니다 :

$(function(){ 
    $('.btn-popover').popover({ 
     html : true, 
     content: function() { 
      return $('#popover_content_wrapper').html(); 
     } 
    }); 

    $(".chbox").change(function(){ 
     alert(1); 
    }); 
}); 

단지 popover의 확인란을 기능에 연결하려고합니다. 내가 어떻게 해?

$('body').on('click', '.chbox', function() { 
    alert(1); 
}); 

업데이트 바이올린 : 다음 .popover() 이후

답변

1

이벤트 핸들러를 첨부 할 수있는 방법을 제공하지 않습니다,이 문제를 해결하기 위해 내가 알고있는 유일한 방법은 함께 http://jsfiddle.net/53pD6/17/

+0

그래, 작동! 고맙습니다! –