jquery-jeditable 不工作
基本上我想要的很简单,当人们单击时,该字段变得可编辑。
更改值后,按键盘上的 Esc/ 或单击外部 ,保存记录。
我不知道为什么它不起作用。 文档似乎不完整...有人知道这是如何工作的吗? 文档页面: http://www.appelsiini.net/projects/jeditable
在这里我发布我现有的代码在这里供大家审查。
testing.html
<head>
<title></title>
<script src="jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="jquery.jeditable.mini.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
$(function() {
$(".click").editable("jeditabletest.php", {
indicator : "<img src='indicator.gif'>",
tooltip : "Click to edit...",
style : "inherit"
});
});
</script>
<style type="text/css">
#sidebar {
width: 0px;
}
#content {
width: 770px;
}
.editable input[type=submit] {
color: #F00;
font-weight: bold;
}
.editable input[type=button] {
color: #0F0;
font-weight: bold;
}
</style>
</head>
<body>
<b class="click" style="display: inline">Click me if you dare!</b></> or maybe you should
</body>
</html>
jeditabletest.php
<?php
echo "hehehe"
?>
有人知道出了什么问题吗? 我尝试了很多次,但根本不起作用。 所有相关的库文件都已经放入了。
basically what I want is simple, when people onclick, the field become editable.
After they change the value, press Esc at keyboard/ or click outside , to save the record.
I'm not sure why it's not working. Documentation seems not complete... Anyone got idea on how this work?
The documentation page: http://www.appelsiini.net/projects/jeditable
Here I post my existing code here for guys to review.
testing.html
<head>
<title></title>
<script src="jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="jquery.jeditable.mini.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
$(function() {
$(".click").editable("jeditabletest.php", {
indicator : "<img src='indicator.gif'>",
tooltip : "Click to edit...",
style : "inherit"
});
});
</script>
<style type="text/css">
#sidebar {
width: 0px;
}
#content {
width: 770px;
}
.editable input[type=submit] {
color: #F00;
font-weight: bold;
}
.editable input[type=button] {
color: #0F0;
font-weight: bold;
}
</style>
</head>
<body>
<b class="click" style="display: inline">Click me if you dare!</b></> or maybe you should
</body>
</html>
jeditabletest.php
<?php
echo "hehehe"
?>
does anyone know what's wrong? I tried so many times, it just not working at all. All related library files are already put in.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
要在用户单击外部时启用提交表单,请执行以下操作:
按 ESC 时提交通常是一个坏主意,因为 ESC 通常保留用于取消。 如果您真的想这样做,您需要编辑 Jeditable 代码。 在 jquery.jeditable.js 中搜索并编辑以下内容:
To enable submitting the form when user clicks outside do the following:
Submitting when pressing ESC is generally a bad idea since ESC is universally reserved for canceling. If you really really want to do this you need to edit Jeditable code. Search and edit the following in jquery.jeditable.js:
是的:我推荐 http://valums.com/edit-in-place/
它使用
div
的contentEditable
属性。 在开始使用它之前,您可能需要先研究一下。杰瑞赫
yeap: i recommend http://valums.com/edit-in-place/
It uses
div
'scontentEditable
property. You may want to look into that before you start using it.jrh
我运行了你的代码,它似乎工作正常。 我认为它不适合你的原因是这个 .html 页面需要从像 http:// /localhost/mypage.html。
每当您尝试保存编辑后的文本时,jeditable 插件都会向服务器发出 AJAX 调用,并且为了使 AJAX 调用正常工作,您需要从服务器运行页面。
希望这可以帮助!
I ran your code and it seemed to work fine. I think the reason why it's not working for you is that this .html page needs to be run from a web server like http://localhost/mypage.html.
The jeditable plugin is making an AJAX call to the server whenever you try to save the edited text and for the AJAX call to work you need to run the page from a server.
Hope this helps!