Can you please take a look at This Demo and let me know what I am doing wrong in this Custom Function to validate the Text input?
$(function () {
var fname = $('#fname').val();
var lname = $('#lname').val();
var proceed = true;
function nameInput(inputData) {
var textBox = $.trim($(inputData).val())
if (textBox == "") {
alert('Field Can Not be Empty');
}
}
$("#pro").on("click", function (e) {
nameInput(fname);
e.preventDefault();
});
});
apparently the nameInput() is returning Field Can Not be Empty in both empty and filled format of the fname input. Thanks