How could I validate forms even before pressing submit button using ajax ?. Error must appear just after entered the value in to the field. Eg:
To validate without clicking the submit button you can use something like: var el = document.getElementById('inputFieldId'); el.onblur = function() { var value_to_validate = el.value; //make an ajax request and send the value from the input field for validation //if the request returns an error attach the proper message to the proper place in the DOM } Code (markup): You can follow this tutorial on how to make ajax requests to validate a form: http://www.designchemical.com/blog/index.php/jquery/create-your-own-jquery-ajax-form-submit-with-validation/