Categories
HTML

How to submit the value of a disabled input field with HTML?

Spread the love

Sometimes, we want to submit the value of a disabled input field with HTML.

In this article, we’ll look at how to submit the value of a disabled input field with HTML.

How to submit the value of a disabled input field with HTML?

To submit the value of a disabled input field with HTML, we replace the disabled attribute with the readonly attribute.

For instance, we write

<input type="text" readonly="readonly" />

to set the readonly attribute to readonly.

This way, the user won’t be able to interact with the input, but the input value will still be submitted.

Conclusion

To submit the value of a disabled input field with HTML, we replace the disabled attribute with the readonly attribute.

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 *