<html lang="en">
<head>
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
<style>
.swal-footer {
text-align: center;
}
</style>
<script type="text/javascript">
//find char replace space
//alert('12-34-56'.replace(/-/g,' '))
var s='hello i am web developer';
//check char count
alert((s.match(/h/g) || []).length);
//create function check char count
function check(s,chk_cout){
return s.split(chk_cout).length-1;
}
var rst=check(s,'e');
//alert(rst);
function validateEmailId(email) {
var regxp = /^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
if (regxp.test(email)) {
return true;
}
else {
var currenttest="please enter valid email address";
swal({
title:currenttest,
button: true,
timer: 3000
});
return false;
}
}
</script>
</head>
<body>
<input type="text" onblur="validateEmailId(this.value)">
</body>
</html>
<head>
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
<style>
.swal-footer {
text-align: center;
}
</style>
<script type="text/javascript">
//find char replace space
//alert('12-34-56'.replace(/-/g,' '))
var s='hello i am web developer';
//check char count
alert((s.match(/h/g) || []).length);
//create function check char count
function check(s,chk_cout){
return s.split(chk_cout).length-1;
}
var rst=check(s,'e');
//alert(rst);
function validateEmailId(email) {
var regxp = /^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
if (regxp.test(email)) {
return true;
}
else {
var currenttest="please enter valid email address";
swal({
title:currenttest,
button: true,
timer: 3000
});
return false;
}
}
</script>
</head>
<body>
<input type="text" onblur="validateEmailId(this.value)">
</body>
</html>
0 Comments
if you have any doubts , please let me know