supermishboy
supermishboy

Reputation: 99

Jquery on span text change

I have <span id="row">text</span>, text inside is changing by another function.

Can I make event 'on this text change'? like

$('#row').text().change(function(){ /some action... });

Upvotes: 1

Views: 2451

Answers (3)

coderz
coderz

Reputation: 4999

Suggest use on function: $("#row").on("change", function() { ... });

Upvotes: 0

Varun
Varun

Reputation: 1946

You can store the old HTML of the div in a variable. Also,use an setInterval of maybe 1 second,to check if the old content is same as current. When this isn't true do something.

Upvotes: 0

Domain
Domain

Reputation: 11808

You can use directly like following:

$('#row').change(function(){
    //some action
});

Upvotes: 1

Related Questions