Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

jquery.mask.min.js truncates last character for phone masking 999-999-999-(999)

My masking is 999-999-999-(999) and my phone number is 123456789000, the result returned is 123-456-789-(000 -- without last braces. However if i put my masking like (999)-999-999-999, the results are correct.

The problem occurs only when braces are at the end.

Update

This is a sample working, please modify it to show the issue on it.

$(document).ready(function()
{
    $("#maskedInput").mask("999-999-999-(999)");
    
    $("#testBtn").click(function()
    {
       console.log($("#maskedInput").val());
    });
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.mask/1.14.15/jquery.mask.min.js"></script>

<input type="text" id="maskedInput">
<button id="testBtn">Show input value</button>

Comments