다양한 조건에 따라 UpdatePanel 내부에 일부 요소가 표시되거나 표시 될 수 있습니다. 나는 clickableImage IMG는 다음과 같이 클릭 할 때 specialMessage SPAN이 표시되도록 그것을 묶을려고jQuery UpdatePanel의 요소에 대한 이벤트
<asp:UpdatePanel ID="MyUpdatePanel" runat="server">
<ContentTemplate>
<asp:Panel ID="MyPanel" runat="server">
<img id="clickableImage" src="/path/to/image.png" alt="Clickable Image" />
<span id="specialMessage">You clicked on the image!</span>
<asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
:
$(document).ready(function() {
$("#clickableImage").click(function() {
$("#specialMessage").show();
});
$("#specialMessage").draggable();
});
을 그러나 MyPanel 종종 볼 수 없습니다 때문에, 때 페이지 로드되지만 (나중에 사용자 상호 작용에 따라 표시 될 수 있음) 이벤트는 연결되지 않습니다. MyPanel이 초기 페이지로드에서 보이지 않더라도 이러한 이벤트를 연결할 수있는 방법이 있습니까?
.ready()의 live() 사용은 괜찮습니까? specialMessage SPAN이 ui.draggable을 사용하기를 원한다면? – Bullines
예. 사실 이상적인 곳이라면 :-) –
참으로 이상적은 아닙니다. http://stackoverflow.com/questions/2024018/using-domcontentready-considered-anti-pattern-by-google을 참조하십시오. – thorn