开发者

Jquery - Jeditable: How Reset to non-editable without page refresh

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

say i have this example

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

and have this divs change class by this function

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

and apply jeditable

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

now when i want to return to its 'non-edita开发者_StackOverflow中文版ble' state i have this

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

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

thanks


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

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.

Hope that helps!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜