Scroll to top

How to trigger (use) an event when contenteditable is changed in jQuery?

Trigger an event when contenteditable is changed



<div class=”changeable” contenteditable=”true”> Click this div to edit it </div>
jQuery(document).ready(function($){
var contents = $(‘.changeable’).html();
$(‘.changeable’).blur(function() {
    if (contents!=$(this).html()){
        alert(‘Handler for .change() called.’);
        contents = $(this).html();
    }
});
});

Leave a Reply

Your email address will not be published. Required fields are marked *