JQuery - Jeditable: how Reset cannot be edited without refreshing the page

is it possible to reset to the initial state after changing the class and using the jeditable plugin

let's say i have this example

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

and these divs will change the class to this function

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

and apply jeditable

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

now that I want to return to its “uneditable” state, I have this

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

but still the “modified” divs are edited, which im trying to do here to set certain divs for editing and not editable, and also if there are any suggestions on how to do it differently, it’s very much appreciated

thanks

+4
source share
1 answer
 $('div.edit').addClass('non_edit').removeClass('edit').unbind('click.editable'); 

This will be done (tested on the jeditable site using the console). All this does is turn off the event, so nothing works. You should also use the correct namespace - my code above works by default.

Hope this helps!

+6
source

Source: https://habr.com/ru/post/1335515/


All Articles