# Convert on Form Submission

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

### Input:

### Required extras

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

- jQuery
- Custom JS (see below)

### jQuery Snippet:

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

            // prevent form submission
            // normally you wouldn't do this but we don't want your page to reload for this demo
            e.preventDefault();
        });
    </script>