i want textbox input pattern like this (1111-111111-5254) and i used this code ,means that when i select row from gridview for editing then in popup window textbox show(-) ,but below code is not working
-
- $("#txtCNIC").attr('maxlength', '16');
- $('#txtCNIC').on('keyup', function () {
- var inp = $('#txtCNIC').val();
- var noinp = inp.split('-').join('');
- if (noinp.length > 4 && noinp.length <= 10) {
- $('#txtCNIC').val(noinp.substring(0, 4) + '-' + noinp.substring(4, noinp.length));
- } else if (noinp.length > 10 && noinp.length <= 14) {
- $('#txtCNIC').val(inp.substring(0, 11) + "-" + noinp.substring(10, noinp.length));
- }
- });