JSFiddle - React, Tailwind, and code Playground

by Samir Chaves

HTML

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/css/toastr.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/js/toastr.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<form id="toastrForm">
  <p>First Name:
    <input type="text" name="firstname" required>
  </p>
  <p>Last Name:
    <input type="text" name="lastname" required>
  </p>
  <button class="btnsubmit" type="submit" value="submit" data-toastr="success" data-message="Thanks for your donate.">Submit</button>
</form>

JavaScript

$(document).ready(function() {
  toastr.options.closeButton = true;
  $('#toastrForm').on('submit', function(event) {
    event.preventDefault();
    toastr.success($('[data-toastr="success"]').data('message'));
  });
})