Skip to content

Instantly share code, notes, and snippets.

@mthri
Created March 7, 2021 12:12
Show Gist options
  • Save mthri/3280f78455c348b96a675ee873f3e681 to your computer and use it in GitHub Desktop.
Save mthri/3280f78455c348b96a675ee873f3e681 to your computer and use it in GitHub Desktop.
check required input
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