diff --git a/index.html b/index.html new file mode 100644 index 0000000..403a99d --- /dev/null +++ b/index.html @@ -0,0 +1,23 @@ + + + + + + + jQuery + + + Welcome!
+
+ + +
+ + + + + \ No newline at end of file diff --git a/lib/validate-email.js b/lib/validate-email.js new file mode 100644 index 0000000..be419aa --- /dev/null +++ b/lib/validate-email.js @@ -0,0 +1,18 @@ +$("#email").keyup(function(){ + // $("#email").css("border-color","green") + console.log(email.value) + validateEmail(email.value) +}) + + +function validateEmail(email){ + let regex =/^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/; + if(regex.test(email)){ + $("#email").css("border-color","green") + $("span").html("good!") + + }else{ + $("#email").css("border-color","red") + $("span").html("Email invalid!") + } +} \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..825a399 --- /dev/null +++ b/package.json @@ -0,0 +1,22 @@ +{ + "name": "jquery-plugin", + "version": "1.0.0", + "description": "your own jquery plugin", + "main": "index.js", + "directories": { + "lib": "lib" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/haripermadi/jquery-plugin.git" + }, + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/haripermadi/jquery-plugin/issues" + }, + "homepage": "https://github.com/haripermadi/jquery-plugin#readme" +}