0

I have a legacy project where an iframe is being appended and has input elements in it. I want to register a focus event on the input elements in that iframe.

A basic recreation of the code is below. It has a button with id addIframe and when its clicked the desired iframe is being appended to a div with the id iframeDiv.

If anyone could help me with this that can be really helpful. Thank you.

$('#addIframe').on('click', () => {
  $('#iframeDiv').append(`<iframe id="appendedIframe" src="http://localhost:8080/iframeDemo.html"></iframe>`)
})
Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
HubballiHuli
  • 777
  • 7
  • 18

0 Answers0