javascriptjqueryformsgoogle-chromegoogle-chrome-devtools

How can I submit a form with input values in Chrome browser console?


I am trying to manually submit a form in Chrome's developer console by running code like:

$('form').submit();

How can I specify the input value of the form in this code? I know the input id/name.


Solution

  • document.querySelector('input[name="theNameOfYourInput"]').value = 'theValue';
    document.querySelector('form').submit();
    

    Chrome console knows nothing of jQuery. Use vanilla JS.