0

I want to do some function when an attribute of a class changes. I wrote following JQuery:

var dropdown = $(".megadropdown").attr("style");

$(dropdown).change(function() {
  alert("hi");
});

So i want to do alert something whne the attriubute style changes. It is not working. Any suggestions?

Marcel Wasilewski
  • 2,519
  • 1
  • 17
  • 34
  • That's the purpose of [MutationObserver()](https://developer.mozilla.org/en/docs/Web/API/MutationObserver), not change event – A. Wolff Dec 17 '15 at 13:57

1 Answers1

0

Instead of just alert. Try:

$(dropdown).change(function() {
window.alert("hi");
});

I had this problem for some reason it worked for me.

Tuck Wise
  • 21
  • 3