3
I am using toastr.js to display form validation messages, but when using this plugin it disabled all my inputs that had the property required
.
My code:
<!DOCTYPE html>
<html>
<head>
<title>TOASTR</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/css/toastr.css">
<script src="http://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/js/toastr.js"></script>
</head>
<body>
<form>
<p>First Name: <input type="text" name="firstname" required></p>
<p>Last Name: <input type="text" name="lastname" required></p>
<p><button class="btnsubmit" type="submit" value="submit" data-toastr="success" data-message="Thanks for your donate.">Submit</button></p>
</form>
<script>
toastr.options.closeButton = true;
$('[data-toastr="success"]').on('click', function (event) {
event.preventDefault();
toastr.success($(this).data('message'));
});
</script>
</body>
</html>
Does anyone know why?
Samir Braga, +1, perfect, worked smooth smooth, and thank you so much for the explanation!
– DevRyu