Word processor style spell check functionality for web applications.
Live Demo: http://www.lpology.com/code/spellcheck/
Javascript/PHP Spell Checker makes it easy to add an MS Word-style spell checker to any web application with almost no configuration. It's fast, lightweight, and works in all major browsers.
- Designed to mimic the appearance and feel of desktop word processor spell checkers.
- Provides a list of suggestions for misspelled words.
- Add spell check to any
<textarea>or<div contenteditable="true"> - Pure Javascript - requires no external libraries.
- Fast and lightweight - less than 4KB, minified and gzipped.
- Tested in IE7+, Firefox 4+, Safari 4+, and Chrome.
- PHP 5.3+ with Pspell extension installed
Copy spellcheck.php to your web directory. Include spellcheck.min.css and spellcheck.min.js into your page:
<head>
<link rel="stylesheet" href="spellcheck.min.css">
<script src="spellcheck.min.js"></script>
</head>Initialize the spell checker when the DOM is ready. There are three required parameters:
var checker = new sc.SpellChecker({
button: 'spellcheck_button', // HTML element that will open the spell checker when clicked
textInput: 'text_box', // HTML field containing the text to spell check
action: 'spellcheck.php' // URL of the server side script
});<textarea id="text_box"></textarea>
<input type="button" id="spellcheck_button" value="Check Spelling">You'll need to install aspell, a dictionary, and the php-pspell module if not already installed:
sudo yum install aspell aspell-en
sudo yum install php-pspell
Then restart Apache:
sudo service httpd restart
Released under the MIT license.