General discussion

Locked

Spell Checking using JavaScript

By lakshmi ·
How to spellcheck the text in the textarea available in the HTML using JavaScript?

This conversation is currently closed to new comments.

7 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Spell Checking using JavaScript

by Jay Eckles In reply to Spell Checking using Java ...

You've got to store a dictionary in a Javascript object...this would probably have to be fairly large if it's going to be a useful spell checker...perhaps you could have an array and store it in an external .js file and include it with a script tag. It would still take a while for the user to download. Once you've got that, you'll have to create a method to split the value of the textarea into words...not too hard, then you'll have to figure out an algorithm for comparing the words to the words in the dictionary; you'll probably want to use some sorting methods to speed up the lookup of where the word would be in the dictionary, then compare it to the word in hand. Finally, you'll need to determine how you'll alert the user that the word is misspelled. If you want to give suggestions, that will be another challenge altogether, and if you want users to be able to "add" to the dictionary (ala Word), you'll have to do some server-side scripting to modify your external .js file.

It's doable, but I wouldn't call it trivial, and there are going to be a couple of significant obstacles to overcome.

Jay Eckles
www.jayeckles.com

Collapse -

Spell Checking using JavaScript

by lakshmi In reply to Spell Checking using Java ...

The question was auto-closed by TechRepublic

Collapse -

Spell Checking using JavaScript

by eBob In reply to Spell Checking using Java ...

It wouldn't be easy. You would have to load some sort of dictionary onto the client (assuming client-side JS), which would take some bandwidth., then search each word of the text box across this dictionary. You may have to allow for "local" variants, too. For example, if you're serving to an English language audience on the WWW, then you would need to allow for the English and American spellings of words like "colour" and "organise" ("color" and "organize" in American). Then there's the possibility of having to deal with non-English languages, and characters.

In the end, you have to ask yourself if it's really worth it.

Collapse -

Spell Checking using JavaScript

by lakshmi In reply to Spell Checking using Java ...

The question was auto-closed by TechRepublic

Collapse -

Spell Checking using JavaScript

by tjc In reply to Spell Checking using Java ...

As you can see by the previous posts you really wouldn't want to because of all the coding involved. An easier way to spellcheck would be to have when the submit the form spellcheck it using the unix/linux dictionary (that is if you are using one ofthose oses for a web host) though some perl or other cgi processing.

Collapse -

Spell Checking using JavaScript

by lakshmi In reply to Spell Checking using Java ...

The question was auto-closed by TechRepublic

Collapse -

Spell Checking using JavaScript

by lakshmi In reply to Spell Checking using Java ...

This question was auto closed due to inactivity

Back to Web Development Forum
7 total posts (Page 1 of 1)  

Related Discussions

Related Forums