JSFiddle - React, Tailwind, and code Playground

HTML

<p>Press ,, </p>
<textarea></textarea>

JavaScript

function correct(string, replace) {
    $("textarea").bind("keyup", function () {
        var $input = $(this),text = $input.val();
        var pos = $('textarea').prop("selectionStart");
        if (new RegExp(string, "g").test(text) == true) {
            $input.val(text.replace(new RegExp(string, "g"), replace));
            this.setSelectionRange(pos - 1, pos - 1);
        }
    });
}
correct(",,", "′");