mercredi 28 novembre 2018

How to restrict textbox in html to only accept letters with space?

I want to restrict textbox to only accept letters with spaces. I have tried this but it is not accepting spaces

<input type="text" 
       maxlength = "15"  
       name="txtName" 
       pattern="[A-Za-z \s*]"  
       class="form-control"  
       placeholder="Name" 
       required="required" 
       class="validate">

I also try this pattern.

pattern="[A-Za-z][" "]" 

I don't want to use any function for this pattern in my code. How can I do this in simple one line code.?

Aucun commentaire:

Enregistrer un commentaire