4
votes

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-editable' 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

1

1 Answers

6
votes
$('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!