JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://creativedream.net/plugins/jquery.modal/js/jquery.modal.min.js"></script>
<link rel="stylesheet" href="http://creativedream.net/plugins/jquery.modal/css/jquery.modal.css">
<form method="post" action="test.aspx" id="form1">
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJODIwMTY2MjU3ZGQVs14nJwqB/iIms8CsXW3SCzs22w==" />
</div>
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="75BBA7D6" />
</div>
<div>
<input name="myTextBox" type="text" id="myTextBox" onchange="checkalphabets(this)" />
<input name="TextBox1" type="text" id="TextBox1" />
</div>
</form>
JavaScript
function checkalphabets(textbox) {
var pattern = /^[a-zA-Z\s]+$/;
if (!pattern.test(textbox.value)) {
modal({
type: 'warning',
title: 'Warning',
text: 'Only Alphabets allowed!',
center: false,
callback: function(){ $("#myTextBox").focus();}
});
exit;
return false;
}
return true;
}
$('.modal-btn').click(function() {
$('#modal-window').hide();
});