I would like to build a script that detects and avoid the form submit which its input has some Cyrillic character between any part of the string. Such as: "John Потоцкая Doe" or contains "JohП"
HTML Base:
<form action="#" id="form-validate">
<input type="text" class="input" id="firstname">
<button class="submit">teste</button>
</form>
jQuery script base:
$(document).ready(function() {
$('#form-validate').submit(function() {
if($('input#firstname').val()("")){
//If "Input" contains a Cyrillic character, for example "John Потоцкая Doe", run the code bellow
alert('Invalid input character, please use Lating only');
//Then alert and empty the input
$('input#firstname').val("")
return false;
}
});
});
If someone can help me I would be very grateful! Thanks a lot in advance.