Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var a = document.getElementsByTagName('input');
- for(var i=0; i<a.length; i++) {
- if((a[i].type!= 'radio')||(a[i].type!= 'checkbox'))
- a[i].maxlength = 5;
- }
- document.getElementsByTagName('input')[1].maxlength="3";
- $().ready(function()
- {
- $("#inputID").maxlength(6);
- });
- $(document).ready(function()
- {
- $("#ms_num").attr('maxlength','6');
- });
- $(document).ready(function () {
- $("#ms_num")[0].maxLength = 6;
- // OR:
- $("#ms_num").attr('maxlength', 6);
- // OR you can use prop if you are using jQuery 1.6+:
- $("#ms_num").prop('maxLength', 6);
- });
- $('input').each(function (index) {
- var element = $(this);
- if (index === 1) {
- element.prop('maxLength', 3);
- } else if (element.is(':radio') || element.is(':checkbox')) {
- element.prop('maxLength', 5);
- }
- });
- $(function() {
- $("#ms_num").prop('maxLength', 6);
- });
- $("#ms_num").attr("maxlength", 6);
- document.getElementById('text_input').setAttribute('maxlength',200);
- $('#yourTextBoxId').live('change keyup paste', function(){
- if ($('#yourTextBoxId').val().length == 11) {
- $('#yourTextBoxId'.val($('#yourTextBoxId'.val().substr(0,10));
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement