0
使用jQueryUI的跨度內,以指定圖像標籤。當用戶在delete_comment_button圖像上單擊,我希望出現一個對話框允許用戶刪除他們的評論。jQueryUI的 - 需要在選擇
挑戰:圖像落在跨度(我的網站上做工精細的其他所有對話框)內。如何在選擇器的範圍內指定圖像?下面
代碼;這裏的jsfiddle:http://jsfiddle.net/GRVBz/1/
HTML
<span class="delete_comment_button"><img src="delete-button.png"></span>
<div id="delete_comment_dialog" title="Alert">
Are you sure you want to delete this comment?
</div>
jQuery的
$(function(){
$("#delete_comment_dialog").dialog({
autoOpen: false,
modal: true,
buttons: {
Cancel: function() { $(this).dialog("close"); }
}
});
});
$('.delete_comment_button img span').click(function() {
$('#delete_comment_dialog').dialog('open');
return false;
});
謝謝回答。出於某種原因,它不工作/解僱。當我點擊圖片時,沒有任何反應。 – chowwy 2012-02-14 23:26:38
我分叉和固定你的jsfiddle,請參閱[這裏](http://jsfiddle.net/AnTfP/1/)。您點擊綁定代碼也是不正確的'$外(函數(){...});'。 – GregL 2012-02-14 23:34:14
謝謝你。接受和upvoted。 – chowwy 2012-02-14 23:47:56