Categories
JavaScript Answers

How to set the value of a input hidden field through JavaScript?

Spread the love

To set the value of a input hidden field through JavaScript, we set the input’s value property.

For instance, we write

document.getElementById("checkyear").value = "1";

to select the input with getElementById.

Then we set its value property to the input value.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *