JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://buyvitamine.com/js/mask/jquery.maskedinput-1.3.min.js"></script>
<input type="text" name="billing[telephone]" value="" title="<?php echo $this->__('Telephone') ?>" class="input-text" id="billing:telephone" />
<input type="text" id="sec" />
JavaScript
var mask = "(599) 999 9999";
//jQuery("#billing\\:telephone").mask(mask);
jQuery("#billing\\:telephone").focus(function () {
jQuery("#billing\\:telephone").val("");
jQuery("#billing\\:telephone").mask(mask);
jQuery("#billing\\:telephone").val("(5");
})
.blur(function () {
jQuery("#billing\\:telephone").unmask(mask);
var a = jQuery("#billing\\:telephone").val();
var reg = new RegExp(" ","g");
a = a.replace(reg,"");
a = a.replace("(","");
a = a.replace(")","");
//jQuery("#billing\\:telephone").val(a); THIS DOES NOT WORK
jQuery("#sec").val(a); // THIS WORKS NICE
});