Jump to content


Photo
- - - - -

Проверка поля ввода на заглавные буквы

jbzoo 2.1.3 submission

Best Answer tapakan , 02 July 2014 - 15:11

Попробуйте этот код.

    jQuery(document).ready(function($) {
        $('.класс элемент').keyup(function() {
            var val = $(this).val();
            $(this).attr('disabled', false);
            if(val.match(/[A-ZА-Я]{2}/)) {
                $(this).attr('disabled', true);
            } 
        });
    });

Добавил.

Go to the full post


  • This topic is locked This topic is locked
4 replies to this topic

#1 EnergY

EnergY
  • JBZoo User (rus)
  • User rate: 0.2
  • posts: 375
  • topics: 101

Posted 02 July 2014 - 14:41

Возможно ли сделать проверку на две подряд идущие заглавные буквы в поле ввода?


  • 0

#2 tapakan

tapakan
  • JBZoo User (rus)
  • User rate: 43.6
  • posts: 624
  • topics: 22

Posted 02 July 2014 - 14:42

Здравствуйте. В каком месте?


  • 0

#3 EnergY

EnergY
  • Topic Starter
  • JBZoo User (rus)
  • User rate: 0.2
  • posts: 375
  • topics: 101

Posted 02 July 2014 - 14:43

в submission, поле itemname


  • 0

#4 tapakan

tapakan
  • JBZoo User (rus)
  • User rate: 43.6
  • posts: 624
  • topics: 22

Posted 02 July 2014 - 15:11   Best Answer

Попробуйте этот код.

    jQuery(document).ready(function($) {
        $('.класс элемент').keyup(function() {
            var val = $(this).val();
            $(this).attr('disabled', false);
            if(val.match(/[A-ZА-Я]{2}/)) {
                $(this).attr('disabled', true);
            } 
        });
    });

Добавил.


Edited by tapakan, 02 July 2014 - 15:31.

  • 1

#5 EnergY

EnergY
  • Topic Starter
  • JBZoo User (rus)
  • User rate: 0.2
  • posts: 375
  • topics: 101

Posted 02 July 2014 - 15:24

спасибо, работает. а как сделать чтоб не давало ничего писать пока не будет одна заглавная?


  • 0





Also tagged with one or more of these keywords: jbzoo 2.1.3, submission

Click to return to top of page in style!