how to do masking in jquery? -


i have 1 text box , 1 submit button. after filling text box,when click on submit button,that text box should masked(we should not able change in text box),not disabled.

 <html> <head>   <script src="http://code.jquery.com/jquery-1.4.2.min.js" type="text/javascript"></script>   <script type="text/javascript">       $(function(){         $('button').click(function(){             var n = $('#name');             if (n.attr('readonly')=='readonly') {                 n.removeattr('readonly');             } else {                 n.attr('readonly','readonly');             }         });     });  </script> </head> <body>        <input type="text" id="name" />        <button> lock </button> </body> 

i'm doing "readonly" attribute, can "mask" attribute.

you can install jquery plugin http://plugins.jquery.com/maskedinput/ , try this-

1) http://digitalbush.com/projects/masked-input-plugin/

2) http://igorescobar.github.io/jquery-mask-plugin/

for example

jquery(function($){    $("#date").mask("99/99/9999");    $("#phone").mask("(999) 999-9999");    $("#tin").mask("99-9999999");    $("#ssn").mask("999-99-9999"); }); 

Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

php - MySQLi multi_query results for later use -