Sorry for general question. I have form id = “formID”, validator for this form and some elements with classses “required”. How should I write onclick method for Save button, so that it wouldn’t work if some of the inputs are empty?
function onSaveButtonClicked() {
if(!($("#formID").valid())) {return};
I tried this, but it’s not working if user click on button before editing some fields.
i.e. if user edit field than erase everything in it – it will work, euther way – not.
You’re missing a closing brace
}. Also,return falsewill prevent the form submission if it is invalid NOTreturn. Try this: