Created
March 7, 2021 12:12
-
-
Save mthri/3280f78455c348b96a675ee873f3e681 to your computer and use it in GitHub Desktop.
check required input
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function full_fill_check(target_element) { | |
let all_required_checked = true | |
$(target_element).find('input:required').each((index, element) => { | |
if (!$(element).val()) { | |
$(element).attr('placeholder', '*اجباری') | |
all_required_checked = false | |
} | |
}) | |
if (!all_required_checked) { | |
Swal.fire( | |
'خطا', | |
'تمامی فیلد ها را پرکنید', | |
'error' | |
) | |
return false | |
} | |
return true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment