I tried to replicate an issue I encountered at work that I cannot attach multiple materialize drop-downs to the on close
event.(only the first one is working)
So I make a snippet here. materialize multiple dropdown
Quite the opposite, even though I explicitly select the first drop down using get[0]
and attach the close
event, the callback fires when I close the second non-selected drop-down too.
Seems like only the first dropdown listens to the event. if I put
$(dropDown).on('close', function() {
console.log(this)
});
This
always refers to the same obj.
Because of the fact that clicking anywhere other than the dropdown would trigger the event, I thought the second dropdown trigger the close event too.
This weird behavior was because I used a older version of materialize, updated the version and the problem is gone.