我的目标是让用户点击一个标记链接并弹出一个对话框,让用户输入一些文字来解释情况。我不确定我应该如何设置它,以便标记链接只会拉出连接到被标记的帖子的对话框。以下是我迄今为止:如何使用jQuery对话框小部件标记帖子?
的jQuery:
$(document).ready(function() {
$(".flagDialog").dialog({
autoOpen: false,
resizable: false,
width: 550
});
$(".flag").click(function() {
var target = $(this);
$(".flagDialog").dialog("open");
$(".flagDialog").dialog("widget").position({
my: 'left top',
at: 'left bottom',
of: target
});
});
});
HTML:
while($row = mysql_fetch_assoc($result)) {
extract($row);
<div class='flag'>Flag</div>
<div class="flagDialog" title="Flag">
<form action="flag.php" class="flagForm" method="post">
<textarea name="flag_input" class="flagInput" rows="6" cols="55"><?php echo $username; ?></textarea>
</form>
</div>
}
目前,当我点击任何一个已经消失了扔对话框的标志链接的所有而循环弹出,这是有道理的,我只是不知道我应该如何去区分它们,并在jQuery端处理它。