JSFiddle - React, Tailwind, and code Playground
by Harsh Kansagara
HTML
<h1>
<a href="#" id="triggerIN">TEST</a>
Check If Clicked Inside iFrame
<input type="text" name="firstName">
</h1>
JavaScript
$(function(){
$('[name="firstName"]').focus();
var onLinkedIn = -1;
$(document).on("mouseenter", ".in_button iframe", function() {
onLinkedIn = 1;
});
$(document).on("mouseleave", ".in_button iframe", function() {
onLinkedIn = -1;
});
$(document).on('mousedown','#triggerIN',function(){
console.log('Event sent to utag!');
})
$(window).blur( function() {
if( onLinkedIn != -1 ){
console.log('Autofilled with LinkedIn');
$('#triggerIN').trigger('mousedown');
}
});
});