JQuery question

Hi,

I need to validate a users email address (reg expression) and then encrypt it using MD5 all with JQuery.

Can any one show me an example of how I would do this ... mostly the MD5 hash thing.

Thanks
LVL 18
Eternal_StudentAsked:
Who is Participating?
 
Kiran SonawaneProject LeadCommented:
Here is code to validate email with RE. Convert it into md5 if the email is valid. You need include md5 jquery plug in attached with this



<html>
<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Kiran Test</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
<script src="jquery.md5.js" type="text/javascript"></script>

<script>
$(document).ready(function(){
     $("#btn").click(function(){
       var email =  $("#email").val();
       if (email!= "" && /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/.test(email)) {
         $("#output").text($.md5($(this).val()));
          alert("Valid email address and below is encrypted value with jquery md5");
       }
       else {
         
         $("#output").text('');
         alert("Invalid email address");
       }
     });
  });
</script>
</head>

<body>
<input type="text" id="email">
<input type="button" id="btn" value="Validate and Convert to MD5">
 <br />
Encrypted value :  <span id="output"></span>
</body>

</html>

Open in new window

jquery.md5.js
0
 
leakim971PluritechnicianCommented:
>I need to validate a users email address (reg expression)
http://bassistance.de/jquery-plugins/jquery-plugin-validation/

>and then encrypt it using MD5 all with JQuery.
https://github.com/blueimp/jQuery-MD5
http://plugins.jquery.com/plugin-tags/md5
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
Eternal_StudentAuthor Commented:
Do you HAVE to use a plugin for the MD5 hash?

I appreciate the links but I was looking for a working example if possible?
0
 
Gurvinder Pal SinghCommented:
<<I appreciate the links but I was looking for a working example if possible?>>
something like this?
http://gtools.org/tool/md5-hash-generator/
or
http://www.webtoolkit.info/demo/javascript-md5
0
 
Eternal_StudentAuthor Commented:
HI Gurvinder,

The 1st link there (gtools) ... how is that working?
0
 
Gurvinder Pal SinghCommented:
<<The 1st link there (gtools) ... how is that working?>>
Did you check on debugger or tried "view source"?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.