I changed my footer.php as follow. But still no response from this function. I think this function is not called. Do I need JQuery setting somewhere else?
<footer>
</footer>
<script>
$.noConflict();
jQuery( document ).ready(function( $ ) {
var form = $("#register-form");
var phone = $('#phnumber').val();
form.submit(function(){
if(validatePhnumber()){
$('#phone-error').html('');
return true;
}else{
$('#phone-error').html('Please enter your Phone Number');
return false;
}
});
function validatePhnumber() {
var phone_re = /^[0-9]+$/;
if (phone.match(phone_re)) {
return true;
}
else {
return false;
}
}
});
</script>
<?php wp_footer() ?>
</body>
</html>