JSFiddle - React, Tailwind, and code Playground

HTML

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

JavaScript

$("textarea").bind("keyup", function() {
    var $input = $(this),
        text = $input.val();
    var pos = text.slice(0, this.selectionStart).length;
        
    $input.val(text.replace(/,,/g, "′"));
    this.setSelectionRange(pos, pos);
});