Taewan Taewan - 3 months ago 73
Javascript Question

How can I submit the form with input value in Chrome Browser Console?

I am trying to manually submit the form in chrome developer console by typing similar code as

$('form').submit();

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

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

Chrome console knows nothing of jQuery. Use vanilla JS.