Snippets Discount

Bootstrap 5 Newsletter Signup Form with Discount Coupon

A newsletter signup card that trades an email address for a 10% welcome coupon, with a copy-to-clipboard code once subscribed and a no-thanks dismiss.

Bootstrap 5 No jQuery Dec 2019 3.7K views

<section class="wdw-stage">
  <div class="container" style="max-width: 880px">
    <div class="wdw-card overflow-hidden" id="couponCard">
      <div class="row g-0">
        <div class="col-md-5 wdw-aurora p-4 p-md-5 d-flex flex-column justify-content-center text-center text-md-start">
          <span class="wdw-eyebrow text-white-50">Welcome offer</span>
          <p class="coupon-big mb-1 mt-2" aria-label="10 percent off">10<span>% off</span></p>
          <p class="mb-0 opacity-75">your first order, just for joining.</p>
        </div>
        <div class="col-md-7 p-4 p-md-5">
          <div id="couponForm">
            <h1 class="h3 wdw-heading mb-2">Get 10% off today</h1>
            <p class="wdw-muted mb-4">Subscribe to our newsletter and we will send your coupon straight away.</p>
            <form id="couponSubscribe" novalidate>
              <div class="form-floating mb-3">
                <input type="email" class="form-control" id="couponEmail" placeholder="[email protected]" required autocomplete="email">
                <label for="couponEmail">Email address</label>
                <div class="invalid-feedback">Please enter a valid email address.</div>
              </div>
              <button type="submit" class="btn btn-primary rounded-pill w-100">Get my coupon</button>
            </form>
            <div class="d-flex justify-content-between align-items-center mt-3 small">
              <button type="button" class="btn btn-link btn-sm text-body-secondary text-decoration-none p-0" id="couponDismiss">No thanks</button>
              <span class="wdw-muted">* $50 minimum purchase</span>
            </div>
          </div>

          <div id="couponDone" hidden class="text-center text-md-start">
            <span class="wdw-icon mb-3"><svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg></span>
            <h2 class="h3 wdw-heading mb-2">You are in!</h2>
            <p class="wdw-muted mb-3">Use this code at checkout. We also emailed it to <strong id="couponSentTo" class="text-body-emphasis"></strong>.</p>
            <div class="input-group mb-2">
              <input type="text" class="form-control text-center fw-bold coupon-code" id="couponCode" value="WELCOME10" readonly aria-label="Coupon code">
              <button class="btn btn-outline-primary" type="button" id="couponCopy">Copy</button>
            </div>
            <p class="small wdw-muted mb-0" role="status" id="couponCopied"> </p>
          </div>

          <div id="couponClosed" hidden class="text-center py-4">
            <p class="wdw-muted mb-3">No problem. The offer will be here if you change your mind.</p>
            <button type="button" class="btn btn-outline-primary rounded-pill" id="couponReopen">Show offer again</button>
          </div>
        </div>
      </div>
    </div>
  </div>
</section>

Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.

Free to use in personal and commercial projects under the MIT license.