echo '
<script>
document.addEventListener("DOMContentLoaded", function () {
var pass1 = document.querySelector("#password"),
pass2 = document.querySelector("#repeat-password"),
email= document.querySelector("#email"),
username = document.querySelector("#username")
email.addEventListener("input", function () {
';
if ( email_exists(<b>Сюда нужно вставить(this.value)</b>) ) { echo '
this.setCustomValidity("' . esc_html__('This email already exists','fashionpress') . '");
'; } echo '
})
username.addEventListener("input", function () {
';
if ( username_exists(<b>Сюда нужно вставить(this.value)</b>) ) { echo '
this.setCustomValidity("' . esc_html__('This name already exists','fashionpress') . '");
'; } echo '
})
pass1.addEventListener("input", function () {
this.value != pass2.value ? pass2.setCustomValidity("'. esc_html__('Password incorrect','fashionpress') .'") : pass2.setCustomValidity("")
})
pass2.addEventListener("input", function (e) {
this.value != pass1.value ? this.setCustomValidity("'. esc_html__('Password incorrect','fashionpress') .'") : this.setCustomValidity("")
})
})
</script>
';
echo '
<script>
if ( in_array(this.value, ["'.implode('","', $emails).'"]) ) {
this.setCustomValidity("' . esc_html__('This email already exists','fashionpress') . '");
}
</script>
';
ns.email_exists = $email_exists; // true
if(ns.email_exists) .... // показать сообщение
<input type="hidden" id="v" value="<?php echo $name?>">