javascript - alert message if default value on submit -
i want alert "enter values fields" on form submission if text field equals default value. doesn't seem working properly. great
$("#info").submit(function() { if ($(".textfield").val() == ('defaultvalue')) { alert("enter value fields") return false; } else { alert("ok"); } }); });
this work issue:
$(document).ready(function(){ $('#info').click(function(e) { $('input[type="text"]').each(function () { if ($(this).val() === "defaultvalue") { alert("enter value fields"); return false; } else { alert("ok"); } }); }); });
Comments
Post a Comment