[JavaScript] How can I make a textarea display other symbols when typing letters?

Like when you press “a” it’s going to display other sorts of character POST specify (eg.a smiley character) within the textarea.

I recently want just one small textarea on the page.Gives thanks.

You would need to handle the actual keydown occurrence and determine which key is currently being constrained or held down.You can then replace the actual letter being typed with some other ASCII or maybe Unicode personality.

EDIT>>>
I’d highly recommend using jQuery with this.Something this way:

$(“#type”).keydown(function( at the )
var keyPressed = at the.keyCode at the.which;

switch( keyPressed )
// change value based on keyPressed
instance 13://enter
// carry out something
split;

);

Employ keyup, keydown, or keypress.Try all those meals and see what kind you think will be most economical and best meets the needs within your program.

I’d suggest carrying this out on the onkeyup occurrence instead for the reason that that receives fired Following letter gets into the text box.

My advice back though, is just not replacing anything while they are typing.I’d advise replacing that characters you wish after they’ve submitted the form.It’s a great deal safer in addition to easier this way.

My advice back though, is just not replacing anything while they are typing.I’d advise replacing that characters you wish after they’ve submitted the form.It’s a great deal safer in addition to easier this way.

Leave a Reply