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

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -