【发布时间】:2014-01-24 06:34:36
【问题描述】:
我正在尝试使用 div 而不是表格,并允许用户对每个“行”进行评论。
我的 div 结构的一个例子是这样的:
<div id="mytable">
<div id="line1" class="line preformatted">
This is my whole entire line!
<div id="popuplink">
<a href="#" id="popup" aria-describedby="ui-tooltip-0" onclick="addComment(event)"><i class="icon-pencil"></i></a>
</div>
</div>
</div>
像这样定义可编辑对象:
$('#popup').editable({
toggle: 'manual',
mode: 'popup',
title: 'Enter comment',
type: 'text',
emptytext: '',
placement: 'right',
display: function(value, response) {
return false; //disable this method
},
success: function(response, newValue) {
alert("success saving: " + newValue);
}
});
由于某种原因,x-editable 弹出窗口不会相对于正确的 div 显示,它一直默认显示在左上角。我该如何解决这个问题?
在此处查看 jsfiddle:http://jsfiddle.net/H9Drf/7/
编辑:我认为问题与每个 div 中“popup”的 id 相同。例如,如果我单击第三行,然后在文本框中写入一些内容并点击“保存”,我可以看出效果发生在第一行,其中第一次出现“id=popup”。仍然不确定从这里去哪里......
【问题讨论】:
-
您希望它实际显示在哪里?
-
@Travis 我希望它显示在行的右侧
-
如在文本的同一行上。
标签: javascript jquery css jquery-ui x-editable