JoyPixels Labs

version 6.6

Convert on Form Submission

This demo shows how you can use jQuery to automatically convert native unicode emoji to their shortnames upon form submission.


Required extras

To get this example working correctly we needed to include a few extra pieces, including:

jQuery Snippet:

<script type="text/javascript">
    $("#myForm").on('submit',function(e) {
        var input = $('#myInput').val();
        var replaced = joypixels.toShort(input);

        // prevent form submission
        // normally you wouldn't do this but we don't want your page to reload for this demo