Корректность ввода input полей на jQuery с помощью регулярки

by Denis Tverdokhlebov

HTML

<form method="post">
  <input type="text" name="cifri" placeholder="Цифры">
  <input type="text" name="bykvi" placeholder="Русские символы + пробел">
  <input type="text" name="alfav" placeholder="Русские, латинские символы и цифры + знаки: .,'-&quot;пробел">
  <input type="submit" name="otprav" value="Отправить">
</form>

CSS

input {
  padding: 6px 9px;
  margin-bottom: 10px;
  width: 50%;
  display: block;
}

JavaScript

$(document).ready(function() {
  $('[name=cifri]').bind("change keyup input click", function() {
    this.value = this.value.replace(/[^0-9]/g, '');
  });
  $('[name=bykvi]').bind("change keyup input click", function() {
    this.value = this.value.replace(/[^а-яА-Я\s]/g, '');
  });
  $('[name=alfav]').bind("change keyup input click", function() {
    this.value = this.value.replace(/[^0-9а-яА-Яa-zA-Z\'\.\,\"\-\s]/g, '');
  });
});