I want to validate the content entered inside the textarea (SimpleMDE) editor. Code should display error if users enter any Indian mobile number inside the text editor.
function validate() {
var regMobile = new RegExp('^[6-9]\d{9}$');
var description = document.getElementById('ph').value;
if (regMobile.test(description)) {
document.write('phone number exists ' + description);
} else {
document.write('phone number not exists ' + description);
}
}
<form name="eve">
<textarea id="ph"></textarea>
<button onclick="validate()">Click me</button>
</form>
e.g. input:
9882223456,
8976785768,
7986576783