Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery Capture Click into iFrame</title> <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script> <style> body{ padding: 30px; } iframe{ width: 100%; height: 200px; border: 2px solid #ccc; } </style> <script> $(document).ready(function(){ $("iframe").on("load", function(){ $(this).contents().on("mousedown, mouseup, click", function(){ alert("Click detected inside iframe."); }); }); }); </script> </head> <body> <iframe src="/examples/html/div-layout.php"></iframe> </body> </html>