JSFiddle - React, Tailwind, and code Playground

by Prajeesh_PR

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.maskedinput/1.4.1/jquery.maskedinput.js"></script>


<input class='newsocial' maxlength="16" />

JavaScript

$(".social, .newsocial").on("keydown keyup", function(e) {
    $(this).prop("value", function(i, o) {
        if (o.length < 13) {
        if((i+1)%4 == 0){
            val+=" ";
          }
        return o.replace(/\d/g,"X")
        }
    })
})