Search
 
SCRIPT & CODE EXAMPLE
 

CSS

form validation with css

// add requited attribute and pattern i html for mail : pattern="[a-z0-9._%+-]+@[a-z0-9.-]+.[a-z]{2,4}$" 
for only text pattern="^[a-zA-Z]+$" ,

required //

input[type="email"]:valid,input[name="name"]:valid {
	border: solid 3px green;
}
input[type="email"]:invalid:focus,input[name="name"]:invalid:focus {
	border: solid 3px red;
}
or 
input:required {
  border-color: #800000;
  border-width: 3px;
}

input:required:invalid {
  border-color: #c00000;
}





// regex for password

Minimum eight characters, at least one letter and one number:
"^(?=.*[A-Za-z])(?=.*d)[A-Za-zd]{8,}$"

Minimum eight characters, at least one letter, one number and one special character:
"^(?=.*[A-Za-z])(?=.*d)(?=.*[@$!%*#?&])[A-Za-zd@$!%*#?&]{8,}$"

Minimum eight characters, at least one uppercase letter, one lowercase letter and one number:
"^(?=.*[a-z])(?=.*[A-Z])(?=.*d)[a-zA-Zd]{8,}$"

Minimum eight characters, at least one uppercase letter, one lowercase letter, one number and one special character:
"^(?=.*[a-z])(?=.*[A-Z])(?=.*d)(?=.*[@$!%*?&])[A-Za-zd@$!%*?&]{8,}$"

Minimum eight and maximum 10 characters, at least one uppercase letter, one lowercase letter, one number and one special character:
"^(?=.*[a-z])(?=.*[A-Z])(?=.*d)(?=.*[@$!%*?&])[A-Za-zd@$!%*?&]{8,10}$"
9
regex passwordJavascript By DieOver on May 11 2020 DonateThankComment
^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*])(?=.{8,})
Source:www.thepolyglotdeveloper.com
5
///// regex for user name 

# works in most newer browsers
^(?=.{8,20}$)(?![_.])(?!.*[_.]{2})[a-zA-Z0-9._]+(?<![_.])$
 └─────┬────┘└───┬──┘└─────┬─────┘└─────┬─────┘ └───┬───┘
       │         │         │            │           no _ or . at the end
       │         │         │            │
       │         │         │            allowed characters
       │         │         │
       │         │         no __ or _. or ._ or .. inside
       │         │
       │         no _ or . at the beginning
       │
       username is 8-20 characters long

# works in all browsers, but does the same as the above RegEx
^(?=[a-zA-Z0-9._]{8,20}$)(?!.*[_.]{2})[^_.].*[^_.]$
Comment

css validation

<p>
<a href="http://jigsaw.w3.org/css-validator/check/referer">
    <img style="border:0;width:88px;height:31px"
        src="http://jigsaw.w3.org/css-validator/images/vcss-blue"
        alt="Valid CSS!" />
    </a>
</p>
Comment

html css form validation

<input
  required 
  type="text" 
  id="first_name"
  name="first_name">
Comment

PREVIOUS NEXT
Code Example
Css :: remove horizontal scroll in small devices css 
Css :: apply margin to all child elements 
Css :: cursor css 
Css :: css clip 
Css :: css class id 
Css :: css make ul on multiple lines 
Css :: change hr tag width css 
Css :: css media query overflow 
Css :: variables scss 
Css :: input background color 
Css :: .col-12 bootstrap 
Css :: value error w2 should be positive but is 
Css :: Submit Button CSS Class 
Css :: align text in block like in word css 
Css :: image cover css 
Css :: how to make a link into normal text css 
Css :: linear gradient in css 
Css :: dropdown size based on text 
Css :: float: down css 
Css :: import scss 
Css :: code css for mozila 
Css :: boostrap breakpoints 
Css :: comentarios en archivo scss 
Css :: flip something css 
Css :: css id selector 
Css :: image transparent 
Css :: webkit appreance none select 
Css :: css animation sin 
Css :: rendre une div scrollable 
Css :: offsetx and offsety in css 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =