I am trying to attach a hover function to a dynamic div ID that is being generated by a script (using Smooch api). The function doesn't work even when I run it in my console after everything has been loaded.
I tried doing:
$(document).on("mouseenter", "#messenger-button", function() {
alert("hey")
});
and I keep getting this error: Uncaught TypeError: Cannot read property 'on' of undefined
The html that is being generated after the Smooch api is initiated looks like this:
<iframe>
<html>
<div id="messenger-button" style="background-color: rgb(10, 74, 119);>
</html>
</iframe>
There is no function that is allowing me to add a class, change the css, or do anything to change the properties for the div in the generated iframe. Can anyone who has used Smooch api tell me how I can add a hover state to the messenger button that is generated?