Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change warning text when pattern is used in input?

Tags:

When I use pattern in input like this:

<input type="text" value="" pattern="(\d|(\d,\d{0,2}))">  

I receive popup warning with text. How can I easily change this text?

like image 270
Torv Avatar asked Jul 31 '12 11:07

Torv


People also ask

What does html5's pattern attribute do?

The pattern attribute specifies a regular expression the form control's value should match. If a non- null value doesn't conform to the constraints set by the pattern value, the ValidityState object's read-only patternMismatch property will be true.

How do you input a pattern?

The pattern attribute specifies a regular expression that the <input> element's value is checked against on form submission. Note: The pattern attribute works with the following input types: text, date, search, url, tel, email, and password. Tip: Use the global title attribute to describe the pattern to help the user.

How do you validate input text in HTML?

To validate the form using HTML, we will use HTML <input> required attribute. The <input> required attribute is a Boolean attribute that is used to specify the input element must be filled out before submitting the Form.


2 Answers

<input type="text" value="" pattern="(\d|(\d,\d{0,2}))" title="YOUR_WARNING_TEXT" >  
like image 80
voodoo417 Avatar answered Oct 20 '22 20:10

voodoo417


The text shown can be defined in the title attribute of the input tag.

like image 25
kgautron Avatar answered Oct 20 '22 20:10

kgautron