Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

jquery observe class change

var $div = $("#foo");
var observer = new MutationObserver(function(mutations) {
  mutations.forEach(function(mutation) {
    if (mutation.attributeName === "class") {
      var attributeValue = $(mutation.target).prop(mutation.attributeName);
      console.log("Class attribute changed to:", attributeValue);
    }
  });
});
observer.observe($div[0], {
  attributes: true
});

$div.addClass('red');
Comment

PREVIOUS NEXT
Code Example
Javascript :: json schema string or null 
Javascript :: nth value of the Fibonacci sequence in js 
Javascript :: ng build staging 
Javascript :: filter falsy values 
Javascript :: javascript scroll function 
Javascript :: javascript thousand separator 
Javascript :: javascript map 2 array of objects 
Javascript :: package json proxy 
Javascript :: VM724:1 Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0 
Javascript :: angular router.navigate pass data 
Javascript :: javascript load multiple images 
Javascript :: get middle of string js 
Javascript :: get value before change and after change js 
Javascript :: how To clear all the input element inside div using jquery 
Javascript :: javascript last element in array 
Javascript :: return first letter of string javascript in uppercase 
Javascript :: js replace characters in a string 
Javascript :: vuejs set 
Javascript :: sequelize limit 
Javascript :: load a page with ajax 
Javascript :: inarray javascript 
Javascript :: Using webpack 5. Reason: future.webpack5 option enabled https://nextjs.org/docs/messages/webpack5 
Javascript :: search content in js 
Javascript :: moment in react native 
Javascript :: javascript format seconds into minutes and second 
Javascript :: copy to clipboard react native 
Javascript :: create path if not exist node js 
Javascript :: javascript infinite loop 
Javascript :: js close window 
Javascript :: append to url javascript 
ADD CONTENT
Topic
Content
Source link
Name
2+8 =