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