JSFiddle - React, Tailwind, and code Playground

HTML

<script src="//cdn.jsdelivr.net/jquery.maskedinput/1.3.1/jquery.maskedinput.min.js"></script>
<input type="text" id="txt_PhoneNumber" /><button id="change">Change</button>

JavaScript

$(document).ready(function()
{
    $("#txt_PhoneNumber").mask("(999) 999-9999");

    $("#change").click(function()
    {
        $("#txt_PhoneNumber").val(Math.random() * 10);
        $("#txt_PhoneNumber").trigger("focus");
    });
});