422
422

Reputation: 5770

Auto correct words as user types

So playing with jquery autocorrect.

And it works great example:

var defaults = {
        corrections: {
            gr8: "great",
            taht: "that",
            ur : "you are",
            arent: "are not"
    }
};

So as user types the word gr8 the script listens for spacebar, and once detected alters the word to its correct replacement.

The issue I have is, we dont want to use word replacements, we want to use unicode replacement similar to this:

 var defaults = {
        corrections: {
            rain: 'u+2602;'
    }
};

So if the user types the word rain it gets replaced with the u+2602 ( but displays the ascii image )

What am I doing wrong, I presume its because this type of script can only parse strings..

Original script here

I dont need anyone to create this for us, just want to know how to echo the symbol .

Upvotes: 3

Views: 1754

Answers (1)

C. K. Young
C. K. Young

Reputation: 223013

You should be able to just use '\u2602' and have that do the Right Thing.

Upvotes: 7

Related Questions