bootstrap form input accept text only

Peter C

Trying to create a contact form and realized that in the name input box, any character (ie. ~ / % @ # and etc.) and numbers can be entered.

<form>
  <label class="control-label" for="name">Full Name</label>
  <input type="text" class="form-control" name="name" id="name" maxlength="30">
</form>

Is there a bootstrap class or jQuery function that I can add to restrict the name input box to only the 26 alphabet? (Or at least no numeric value allowed...) Any help would be appreciated :)

DDan

You can do it with some jquery. Something like this: http://jsfiddle.net/ddan/ka52kdLv/2

<input class="alphaonly">
$('.alphaonly').bind('keyup blur',function(){ 
    var node = $(this);
    node.val(node.val().replace(/[^a-z ]/g,'') ); }
);

Or for a beautiful solution you can take a look for some validation libs.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

To allow input text accept only numbers

From Dev

Jasny Bootstrap: can I specify File Input to accept only images?

From Dev

Access Form won't accept input in text boxes

From Dev

Access Form won't accept input in text boxes

From Dev

How to validate an input type="text" element to only accept certain content?

From Dev

accept only number in input text box without using script

From Dev

Align inline text input in Bootstrap Form

From Dev

Accept only a letter input

From Dev

Accept only numeric input

From Dev

Accept only numeric input

From Dev

Why does bootstrap accept form styling for only one highly specific css classes?

From Dev

How to decrease space between input text fields of form in bootstrap

From Dev

Bootstrap button is not on the same row with text input in horizontal form

From Dev

how to insert filled text area only from the input form?

From Dev

how to set text field that only accept number and comma (,) in PDF Fillable Form?

From Dev

Accept only 12 comma seperated values for input type text html5

From Dev

How to restrict a text input only to accept letter M and F using HTML 5(preferably) or javascript(no jquery)

From Dev

How to use an input type=text field to accept only digits, minus sign and decimals and nothing more with Angular

From Dev

Bootstrap Form FIle input

From Dev

Accept only normal date in html form

From Dev

Accept only normal date in html form

From Dev

Accept only one or more files in html form

From Dev

Angular 2 - accept only natural number in input

From Java

Limit input to only accept parentheses, not letters or numbers

From Dev

Making EditText input only accept numbers not working

From Dev

Userform input field to accept ONLY minutes and seconds

From Dev

Input field which accept only number with maxlength

From Dev

Which annotation to use for only accept number as input?

From Dev

Input accept numbers-only custom directive

Related Related

  1. 1

    To allow input text accept only numbers

  2. 2

    Jasny Bootstrap: can I specify File Input to accept only images?

  3. 3

    Access Form won't accept input in text boxes

  4. 4

    Access Form won't accept input in text boxes

  5. 5

    How to validate an input type="text" element to only accept certain content?

  6. 6

    accept only number in input text box without using script

  7. 7

    Align inline text input in Bootstrap Form

  8. 8

    Accept only a letter input

  9. 9

    Accept only numeric input

  10. 10

    Accept only numeric input

  11. 11

    Why does bootstrap accept form styling for only one highly specific css classes?

  12. 12

    How to decrease space between input text fields of form in bootstrap

  13. 13

    Bootstrap button is not on the same row with text input in horizontal form

  14. 14

    how to insert filled text area only from the input form?

  15. 15

    how to set text field that only accept number and comma (,) in PDF Fillable Form?

  16. 16

    Accept only 12 comma seperated values for input type text html5

  17. 17

    How to restrict a text input only to accept letter M and F using HTML 5(preferably) or javascript(no jquery)

  18. 18

    How to use an input type=text field to accept only digits, minus sign and decimals and nothing more with Angular

  19. 19

    Bootstrap Form FIle input

  20. 20

    Accept only normal date in html form

  21. 21

    Accept only normal date in html form

  22. 22

    Accept only one or more files in html form

  23. 23

    Angular 2 - accept only natural number in input

  24. 24

    Limit input to only accept parentheses, not letters or numbers

  25. 25

    Making EditText input only accept numbers not working

  26. 26

    Userform input field to accept ONLY minutes and seconds

  27. 27

    Input field which accept only number with maxlength

  28. 28

    Which annotation to use for only accept number as input?

  29. 29

    Input accept numbers-only custom directive

HotTag

Archive