Yes, we can use a Submit Button Outside of a Form.

Have you ever felt like you’ve been a professional developer or designer forever, and somehow not known something basic, and borderline hate yourself?

We can tie a submit button to a form that the button doesn’t live inside of. The trick is to give the form an id and then reference that id with the button’s form property.

<form id="myForm">
    <label for="email">Email:</label>
    <input type="email" name="email" placeholder="Email" />
</form>

<!-- Submit button not in parent form! -->
<button type="submit" form="myForm">Submit!</button>

In that past I’ve executed CSS magic tricks to accomplish buttons displaying outside of their form area. Did you know about this attribute?

I became a software developer because I enjoy building, creating and solving problems. I mentor several American, European and Indian startups. I enjoy guiding them through the journey of creating and developing their ideas, and turning them into a reality.
Posts created 26

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top