File tree Expand file tree Collapse file tree 3 files changed +21
-5
lines changed Expand file tree Collapse file tree 3 files changed +21
-5
lines changed Original file line number Diff line number Diff line change 6161 }
6262
6363 validateField ( field ) {
64- field . insertAdjacentHTML ( 'afterend' , this . errorDiv ) ;
64+ if (
65+ ! (
66+ field . nextSibling . classList &&
67+ field . nextSibling . classList . contains ( this . settings . errorElement )
68+ )
69+ ) {
70+ field . insertAdjacentHTML ( 'afterend' , this . errorDiv ) ;
71+ }
6572
6673 field . oninvalid = ( ) => {
6774 field . classList . add ( this . settings . invalidClass ) ;
7582 } ;
7683 }
7784 }
85+
7886 </ script >
7987
8088 < script >
8189 new html5formValidation ( )
8290 </ script >
8391</ body >
84- </ html >
92+ </ html >
Original file line number Diff line number Diff line change @@ -44,7 +44,14 @@ export default class html5formValidation {
4444 }
4545
4646 validateField ( field ) {
47- field . insertAdjacentHTML ( 'afterend' , this . errorDiv ) ;
47+ if (
48+ ! (
49+ field . nextSibling . classList &&
50+ field . nextSibling . classList . contains ( this . settings . errorElement )
51+ )
52+ ) {
53+ field . insertAdjacentHTML ( 'afterend' , this . errorDiv ) ;
54+ }
4855
4956 field . oninvalid = ( ) => {
5057 field . classList . add ( this . settings . invalidClass ) ;
Original file line number Diff line number Diff line change 11{
22 "name" : " html5-form-validator" ,
3- "version" : " 0.0.1 " ,
3+ "version" : " 0.0.2 " ,
44 "description" : " The most simple HTML5 form validator" ,
55 "main" : " index.js" ,
66 "repository" : {
77 "type" : " git" ,
88 "url" : " git+https://github.com/scriptex/html5-form-validator.git"
99 },
1010 "keywords" : [" HTML5" , " form" , " validator" ],
11- "author" : " Atanas Atanasov <scriptex.bg@gmail.com> (https://github.com/scriptex)" ,
11+ "author" :
12+ " Atanas Atanasov <scriptex.bg@gmail.com> (https://github.com/scriptex)" ,
1213 "license" : " MIT" ,
1314 "bugs" : {
1415 "url" : " https://github.com/scriptex/html5-form-validator/issues"
You can’t perform that action at this time.
0 commit comments