JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://raw.githubusercontent.com/digitalBush/jquery.maskedinput/master/src/jquery.maskedinput.js"></script>
<input type="text" id="txt_PhoneNumber" />
<button type="button" id="btn">9</button>
JavaScript
$('#txt_PhoneNumber').mask('(999) 999-9999');
$('#btn').click(function() {
$("#txt_PhoneNumber").val(function(i, val) {
return val + '9';
}).trigger('input');
});