I have an iframe and I want it to be draggable, but I can't access listen to it via a css selector for jquery: $("iframe").on("click")
doesn't work.
I saw some people, wrapping their iframe with a div, so the iframe takes the all height and width of the div. I can select the div via $(".draggable")
, but the event listener on click on the div doesn't work...
Here are some examples :
The iframe is in blue and the wrapping div in white, I add an event listener on the div like that :
$(".draggable").on("click", () => console.log("hello"))
The event is fired when I click on the white side (not the iframe side).
In that second example, the iframe width and height are the same as the div and when I click on it nothing happens.
Do you have any ideas to fire that event when clicking on the div ?