I'm trying to make an HTML page (that is simply a form) that accepts both English and Arabic inputs. For example: First Name and Last Name: (Have to be in English) Full name in Arabic: (Has to be in Arabic) I tried playing around by using the following code:
function isArabic(text) {
var pattern = /[\u0600-\u06FF\u0750-\u077F]/;
result = pattern.test(text);
return result;
}
But I'm not experienced in javascript and am having a hard time getting it to work and linking it properly in the html
This is a sample of the HTML:
<form name="taskForm" action="/action_page.php" onsubmit="return validateForm()" method="post">
<b>First Name: </b>
<br>
<input type="text" name="firstName" max="15" required>
<br><br>
<b>Last name: </b>
<br>
<input type="text" name="lastName" max="15" required>
<br><br>
<b>Name in Arabic: </b>
<br>
<input type="text" name="arName" max="100">
<br><br>
<b>Gender: </b>
<br><input type="radio" name="Gender" value="male" required> Male
<input type="radio" name="Gender" value="female" required> Female
<br><br>
<b>Salary: </b>
<br>
<input type="number" name="salary" step="0.001" min="0">
<br><br>
</form>