Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. var a = document.getElementsByTagName('input');
  2. for(var i=0; i<a.length; i++) {
  3. if((a[i].type!= 'radio')||(a[i].type!= 'checkbox'))
  4. a[i].maxlength = 5;
  5. }
  6. document.getElementsByTagName('input')[1].maxlength="3";
  7.  
  8. $().ready(function()
  9. {
  10. $("#inputID").maxlength(6);
  11. });
  12.  
  13. $(document).ready(function()
  14. {
  15. $("#ms_num").attr('maxlength','6');
  16. });
  17.  
  18. $(document).ready(function () {
  19. $("#ms_num")[0].maxLength = 6;
  20. // OR:
  21. $("#ms_num").attr('maxlength', 6);
  22. // OR you can use prop if you are using jQuery 1.6+:
  23. $("#ms_num").prop('maxLength', 6);
  24. });
  25.  
  26. $('input').each(function (index) {
  27. var element = $(this);
  28. if (index === 1) {
  29. element.prop('maxLength', 3);
  30. } else if (element.is(':radio') || element.is(':checkbox')) {
  31. element.prop('maxLength', 5);
  32. }
  33. });
  34.  
  35. $(function() {
  36. $("#ms_num").prop('maxLength', 6);
  37. });
  38.  
  39. $("#ms_num").attr("maxlength", 6);
  40.  
  41. document.getElementById('text_input').setAttribute('maxlength',200);
  42.  
  43. $('#yourTextBoxId').live('change keyup paste', function(){
  44. if ($('#yourTextBoxId').val().length == 11) {
  45. $('#yourTextBoxId'.val($('#yourTextBoxId'.val().substr(0,10));
  46. }
  47. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement