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 video slider with cuncks of videos without download all videos?

 Create video slider with cuncks of videos without download all videos function custom_video_slider_shortcode() { $slider_id = 'vide...