Insert emoji into html input

Asked

Viewed 1,132 times

0

I would like to know pq when I insert the emoji code into an html input not emoji but hexadecimal code, if I insert the code in any area in html works less in the input field. I tried to insert in VALUE but without success. Someone would know me

<input type="text" id="send_msg" name="message" class="write_msg" value="&#x1f603;" role="image" placeholder="Digite aqui sua mensagem" />

1 answer

0

Use <meta charset="UTF-8"> so that there is consistency in the appearance of emoji between platforms.

HTML

<input id='usrInput' value=''>

Javascript

document.getElementsByTagName("INPUT")[0].value = String.fromCodePoint(0x1F354);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.