$(document).ready(function(){
if($("#field-huima-0-value").val()=='' && $(".link-field .form-text").val() =='')
$("#edit-submit").click(function(){
alert("you must at least enter one value!");
});
});
field-huima-0-value and .link-field .form-text are two input text boxes id and class.
when the two input text boxes is null. i click the submit button. the alert box shows, then i click ok. the form still be submitted. but now,i want to prevent the form from submitting. so i add the return false; under the alert line. it can prevent the form submitting.but when i type a value into one input boxes of the them, when click the button. it still shows the alert box.
I think you code needs some modifications, kindly check this out:
this code will attach the check function to the click event of your submit button, and only returns false if the check didn’t succeed.
Update: I’ve updated the above code ans tested it, and now working fine, also I’ve made you a sample to test this code, kindly follow this link: http://jsfiddle.net/6egtW/1/
let me know what happened.