How to implement Jquery Validation .I have use this code but not implememnt properly.
$(document).ready(function () {
$("#result-form").validate(); // intialize plugin
// presumably, this would be called after you dynamically create the new elements
$('input[type="text"]').each(function () {
$(this).rules('add', {
required: true,
digits: true,
messages: {
required: " Please enter a score!",
digits: " Please only enter numbers!"
}
});
});
});
In button click .I want to implement this code here.
$("#btnSend").click(function (e) {
var toEmail = $.trim($("#txtTo").val());
var body = $.trim($("#txtBody").val());
e.preventDefault();
var reportManagement = {
toEmail: $.trim($("#txtTo").val()),
body: $.trim($("#txtBody").val())
};
Jenith ThakkarPosted Oct 1, 2020, 1:20 AM
if you're not using form then do it in custom way
set span after inputs
and check using jquery if value is blank then show that span and return false
Mageshwaran RPosted Oct 1, 2020, 1:34 AM
Amit KumarPosted Oct 1, 2020, 12:40 AM
Sachin SinghPosted Sep 30, 2020, 11:33 AM