Search code examples
jquerybrowser-extension

Filling input label from Browser extension with jQuery


$('#email').val('[email protected]').trigger('change');

Trying to fill the input field with this line, The code working perfectly (Fill the from and active the button) on chrome & other browser console.

When running from exnantiosn this code fill the from but did't active the button.

What i'm doing wrong?


Solution

  • Got help from someone and the solution is:

    $('#email').val('[email protected]').get(0).dispatchEvent(new InputEvent('change'));

    This code input the val on the input field and active the button from browser extension.