반응형

document.getElementById('P300_전화번호').addEventListener('input',function(y)
{
var output = y.target.value.replace(/\D/g,'').match(/(\d{0,3})(\d{0,4})(\d{0,4})/);
y.target.value = !output[2]?output[1]:output[1]+'-'+output[2]+(output[3]?'-'+output[3]:'');
});



document.getElementById('P300_사업자번호').addEventListener('input',function(y)
{
var output = y.target.value.replace(/\D/g,'').match(/(\d{0,3})(\d{0,2})(\d{0,5})/);
y.target.value = !output[2]?output[1]:output[1]+'-'+output[2]+(output[3]?'-'+output[3]:'');
});

 

+ Recent posts