"Phone mask with jQuery and Masked Input latest"
Bootstrap 4.1.1 Snippet by muhittinbudak

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!------ Include the above in your HEAD tag ----------> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.maskedinput/1.4.1/jquery.maskedinput.min.js"></script> <div class="container"> <div class="row"> <div class="container"> <h2>Phone mask with jQuery and Masked Input</h2> <input class="form-control" id="phone-number" name="phone-number" type="text" /> <br> <button class="btn btn-primary btn-lg" id="dugme">Click</button> <br /> <br /> <br /> <label>value </label> <div class="alert alert-primary" id="stripVal"> . </div> <label>Stripped value </label> <div class="alert alert-success" id="sonucAlan"> . </div> <br> </div> </div> </div>
$.mask.definitions['#'] = $.mask.definitions['9']; //Set # to do what 9 does $.mask.definitions['9'] = null; //Remove 9 as a masking character $("input").mask("(09) ###-###-####"); $("#dugme").click(function() { var val1 = $('#phone-number').maskVal(); $("#sonucAlan").text(val1); $("#stripVal").text($('#phone-number').val()); }); //striped value function $.fn.maskVal = function () { return $(this).mask(); };

Related: See More


Questions / Comments: