20 January 2020

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();
    }
});


});

No comments:

Post a Comment

How to create youtube videos slider with play and pause option in wordpress?

Create youtube videos slider with play and pause option in wordpress youtube videos slider Use this shortcode:- [punjab_today] function my_...