Jquery - Jeditable:如何在不刷新页面的情况下重置为不可编辑 [英] Jquery - Jeditable: How Reset to non-editable without page refresh

查看:83
本文介绍了Jquery - Jeditable:如何在不刷新页面的情况下重置为不可编辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在更改课程并应用可编辑插件后重置为原始状态

is it possible to reset to original state after changing class and applying the jeditable plugin

说我有这个例子

<div class="non_edit" id="test1">test1</div>
<div class="non_edit" id="test2">test2</div>

并通过此函数更改此类div

and have this divs change class by this function

$('div.non_edit').addClass('edit').removeClass('non_edit');

并申请jeditable

and apply jeditable

$('.edit').editable('somepage.php');  

现在当我想回到'不可编辑'的状态时,我有这个

now when i want to return to its 'non-editable' state i have this

$('div.edit').addClass('non_edit').removeClass('edit');

但是'更改'的div仍然是可编辑的,我在这里尝试做的是设置某些div可编辑且不可编辑的
,如果有任何关于如何以其他方式执行此操作的建议,我们非常感谢

but still the 'changed' divs are editable, what im trying to do here is to set certain divs editable and non editable , and also if there are any suggestions on how to do this in another way is much appreciated

谢谢

推荐答案

$('div.edit').addClass('non_edit').removeClass('edit').unbind('click.editable');

这样做(使用控制台在jeditable网站上测试)。所有这一切都是解除事件的束缚,所以没有任何事情发生。你必须使用正确的命名空间 - 上面的代码在默认情况下工作。

This will do it (tested on jeditable site using console). All this is doing is unbinding the event so nothing fires. You must use the correct namespacing as well - my code above works on the default.

希望有所帮助!

这篇关于Jquery - Jeditable:如何在不刷新页面的情况下重置为不可编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆