【发布时间】:2013-02-21 17:03:33
【问题描述】:
我有以下脚本
$(function() {
$(".draggable").draggable({
revert: true
});
$("#droppable").droppable({
over: function() {
$(this).css('backgroundColor', '#cedae3');
},
out: function() {
$(this).css('backgroundColor', '#CDAF95');
},
drop: function(e, ui) {
$(ui.draggable).trigger('click');
}
});
});
我有多个可拖动对象,每个人都在一个 td 中。在每个可拖动对象中,我都有一个按钮。
如何在放置时触发按钮从放置的可拖动对象?这不起作用:$(ui.draggable).trigger('click'); 有人有什么建议吗?
<td class="draggable" class="ui-widget-content">
<form action="index.php" method="post">
<?php echo $produs['nume_produs']; ?>
<hr />
Pret: <?php echo $produs['pret']; ?> lei
<br />
<input type="hidden" name="nume_produs" value="<?php echo $produs['nume_produs']; ?>" />
<input type="hidden" name="produs_id" value="<?php echo $produs['id']; ?>" />
<input type="hidden" name="pret" value="<?php echo $produs['pret']; ?>" />
<input type="submit" name="adauga" class="adauga" value="Adauga"/>
</form>
<td>
【问题讨论】:
-
要在哪个 dom 上触发点击事件...因为您需要指定选择器代替 ui.draggable..
标签: jquery