validate email input javascript onchange
<script type="text/javascript">
function ShowAlert() {
var email = document.getElementById('txtEmailId');
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (!filter.test(email.value)) {
alert('Please provide a valid email address');
email.focus;
return false;
}
else {
alert("Thanks for your intrest in us, Now you
will be able to receive monthly updates from us.");
document.getElementById('txtEmailId').value = "";
}
}
</script> <input input type="text" name="txtEmailId" id="txtEmailId" />
<input type="submit" class="button" value="Suscribe" name="Suscribe"
onclick="javascript:ShowAlert()" />
Also in JavaScript:
- html button click only once
- jquery async await $.getScript(
- bcrypt compare hash and password
- textcontent in javascript
- javascript string first letter lowercase
- how pass data from body in koa js
- bq show pretty json
- simple alert program in javascript
- resolver in angular
- scroll position
- redirect users to anmother page in javascript
- Material-ui alarm icon
- js ajax
- async useeffect
- javascript array to object with keys
- get value from JSON.stringify
- regex char or char
- jquery number format thousand k
- react native keyboard event listener
- what 1hr in milliseconds in javascript
- react js download file
- onclick react
- how to stop bubbling in javascript
- javascript fetch json