Govind Samrow Govind Samrow - 1 year ago 72
HTML Question

Trigger for span text/html on changed

Is there any event for

span
tag text/html change ?

Code:

<span class="user-location"> </span>

$('.user-location').change(function () {
//Not working
});


Thanks in advance!

Answer Source

you can use DOMSubtreeModified to track changes on your span element i.e(if text of your span element changes dynamically ).

$('.user-location').on('DOMSubtreeModified',function(){
  alert('changed')
})

check out the followinf link https://jsbin.com/volilewiwi/edit?html,js,output

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download