0

i want to edit content inside the "pre" tag. On a button click i want to know whether the content is changed or not. How can i possible this using "jquery"?

Nighina t t
  • 140
  • 1
  • 4
  • 15

1 Answers1

0

You can use: DOMSubtreeModified

$('.change-text-button').on('click', function(){
    $('.my-pre').text('Some other text');
});



$('.my-pre').bind("DOMSubtreeModified",function(){
  console.log('changed');
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button class="change-text-button">Change text</button>
<pre class="my-pre">Lorem ipsum dolor sit amet</pre>
caramba
  • 21,963
  • 19
  • 86
  • 127