Add class to element when price content changes JQuery DOMCharacterDataModified -


$ H <>

$ price changes, I want to add a square in the price period. I add better products to customers when looking at better visual leads .

Tried:

  $ (document) .ready (function () {$ ('cart-price'). ('DOMCharacterDataModified', function () { $ ('. Cart-price')) addClass ('change'); var delay = setTimeout (function () {$ ('cart-price'). RemoveClass ('change');}, 1100)});} );  

CSS:

 . Cart-price.change {color: # F00; }  

It seems that it would be better to use because it has been excluded but its Be aware of - IE & lt; 11 does not support it

  $ (document) .ready (function () {var $ cartprice = $ ('cart-price'); if (in 'mutationObserver' window) {var inspector = New Mutation Observer; Observer Blog ($ CarPrice [0], {Child list: True}) //} For other browsers that do not support Mutation Observer $ CartPrice ('DOMSubtreeModified', Highlight ) Function highlights () {$ cartprice.addClass ('change'); var delay = set timeout (function () {$ cartprice.removeClass ('change');}, 1100)}});  

Demo:


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -