Taewan
Taewan

Reputation: 1227

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.

Upvotes: 2

Views: 20431

Answers (2)

sachin
sachin

Reputation: 491

document.querySelector() can be replaced by $()

$('input[name="theNameOfYourInput"]').value = 'theValue';

$('form').submit();

Upvotes: 0

user6661325
user6661325

Reputation:

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

Chrome console knows nothing of jQuery. Use vanilla JS.

Upvotes: 9

Related Questions