An open API service indexing awesome lists of open source software.

https://github.com/thinkphp/mailcheck.js

A MooTools plugin that suggests a right domain when your users misspell it in an email address using Levenshtein Distance.
https://github.com/thinkphp/mailcheck.js

Last synced: 7 months ago
JSON representation

A MooTools plugin that suggests a right domain when your users misspell it in an email address using Levenshtein Distance.

Awesome Lists containing this project

README

          

mailcheck.js
============

A MooTools plugin that suggests a right domain when your users misspell it in an email address using Levenshtein Distance.

![Screenshot](http://farm8.staticflickr.com/7216/6857832762_56f14145a9.jpg)

How to use
----------

Include MooTools, Mailcheck.js and String.levenshtein.js into the page:



When your user types in "adrian@yahuu.com", Mailcheck will suggest "adrian@yahoo.com".

#HTML

Email


When DOM is ready:

#JS

var domains = ['hotmail.com', 'gmail.com', 'yahoo.com','aol.com','excite.com','thinkphp.ro']

$('email').addEvent('keyup',function(){

new Mailcheck($('email'),{domains: domains, onSuggested: function(suggestions){

$("suggestions").set('html', 'Did you mean ' + suggestions.join(", ") + " ?");

},onEmpty: function(){

//do stuff
}
})
})

References:

- http://thinkphp.ro/apps/js-hacks/String.levenshtein/String.levenshtein.html
- https://github.com/Kicksend/mailcheck
- http://en.wikipedia.org/wiki/Levenshtein_distance