From 7126a70e81f5294da2388a66465bccc52959e61f Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Thu, 17 Jan 2019 16:41:01 -0600 Subject: [PATCH] Add Submit A Form With A Button Outside The Form as an html til --- README.md | 7 +++++- ...t-a-form-with-a-button-outside-the-form.md | 25 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 html/submit-a-form-with-a-button-outside-the-form.md diff --git a/README.md b/README.md index 3623c6b..4e11e15 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/). For a steady stream of TILs from a variety of rocketeers, checkout [til.hashrocket.com](https://til.hashrocket.com/). -_738 TILs and counting..._ +_739 TILs and counting..._ --- @@ -24,6 +24,7 @@ _738 TILs and counting..._ * [Elixir](#elixir) * [Git](#git) * [Go](#go) +* [HTML](#html) * [Internet](#internet) * [JavaScript](#javascript) * [Linux](#linux) @@ -226,6 +227,10 @@ _738 TILs and counting..._ - [Sleep For A Duration](go/sleep-for-a-duration.md) - [Upgrading From An Older Version On Mac](go/upgrading-from-an-older-version-on-mac.md) +### HTML + +- [Submit A Form With A Button Outside The Form](html/submit-a-form-with-a-button-outside-the-form.md) + ### Internet - [Add Emoji To GitHub Repository Description](internet/add-emoji-to-github-repository-description.md) diff --git a/html/submit-a-form-with-a-button-outside-the-form.md b/html/submit-a-form-with-a-button-outside-the-form.md new file mode 100644 index 0000000..ed91c75 --- /dev/null +++ b/html/submit-a-form-with-a-button-outside-the-form.md @@ -0,0 +1,25 @@ +# Submit A Form With A Button Outside The Form + +You 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. + +```html +
+
+ + +
+ + + + +
+``` + +With this setup, clicking the _Submit_ button will cause the form to be +submitted. + +See the [MDN Button +docs](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button) for +more details.