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 61
61
}
62
62
63
63
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
+ }
65
72
66
73
field . oninvalid = ( ) => {
67
74
field . classList . add ( this . settings . invalidClass ) ;
75
82
} ;
76
83
}
77
84
}
85
+
78
86
</ script >
79
87
80
88
< script >
81
89
new html5formValidation ( )
82
90
</ script >
83
91
</ body >
84
- </ html >
92
+ </ html >
Original file line number Diff line number Diff line change @@ -44,7 +44,14 @@ export default class html5formValidation {
44
44
}
45
45
46
46
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
+ }
48
55
49
56
field . oninvalid = ( ) => {
50
57
field . classList . add ( this . settings . invalidClass ) ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " html5-form-validator" ,
3
- "version" : " 0.0.1 " ,
3
+ "version" : " 0.0.2 " ,
4
4
"description" : " The most simple HTML5 form validator" ,
5
5
"main" : " index.js" ,
6
6
"repository" : {
7
7
"type" : " git" ,
8
8
"url" : " git+https://github.com/scriptex/html5-form-validator.git"
9
9
},
10
10
"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)" ,
12
13
"license" : " MIT" ,
13
14
"bugs" : {
14
15
"url" : " https://github.com/scriptex/html5-form-validator/issues"
You can’t perform that action at this time.
0 commit comments