Skip to content

Commit d8df34e

Browse files
committed
Fixed issue victorjonsson#4, changde html in example page, added select example
1 parent bd66a8e commit d8df34e

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

example.html

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ <h2>
3535
</code>
3636

3737
<h2>Example of all features</h2>
38-
<section>
38+
<div class="section">
3939
<form action="" onsubmit="if($(this).validate()) alert('Valid!'); return false;">
4040
<p>
4141
<strong>Required</strong> <em>required</em><br/>
@@ -125,11 +125,19 @@ <h2>Example of all features</h2>
125125
</p>
126126

127127
<p>
128-
<strong>These two inputs has to have identical values (minimum 3 characters)</strong> <em>validate_confirmation</em><br/>
128+
<strong>These two inputs has to have identical values (minimum 3 characters)</strong> <em>validate_confirmation length3</em><br/>
129129
<input name="something" data-validation="validate_confirmation validate_min_length length3"/>
130130
<input name="something_confirmation"/>
131131
</p>
132-
132+
<p>
133+
<strong>These features applies to select lists as well</strong>
134+
<select name="whatever" data-validation="required">
135+
<option value="">- - Select something - -</option>
136+
<option value="1">Green</option>
137+
<option value="2">Blue</option>
138+
<option value="red">Red</option>
139+
</select>
140+
</p>
133141
<p>
134142
<strong>Length restriction</strong>
135143
<span class="chars_left">
@@ -145,12 +153,12 @@ <h2>Example of all features</h2>
145153
<input type="submit" value="Validate form"/>
146154
</p>
147155
</form>
148-
</section>
156+
</div class="section">
149157

150158
<h2>
151159
Customized example (no border color on error, different position on error messages)
152160
</h2>
153-
<section>
161+
<div class="section">
154162
<form action="" id="custom_form">
155163
<p>
156164
<strong>Length between 3-5 characters</strong> <em>validate_length length3-5</em><br/>
@@ -205,6 +213,6 @@ <h2>
205213

206214
</script>
207215

208-
</section>
216+
</div class="section">
209217
</body>
210218
</html>

jquery.formvalidator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@
289289
//
290290
// Reset style and remove error class
291291
//
292-
$(this).find('input,textarea')
292+
$(this).find('input,textarea,select')
293293
.css('border-color', jQueryFormUtils.defaultBorderColor)
294294
.removeClass(config.errorElementClass);
295295

style.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ h1 {
2121
margin-bottom: 20px;
2222
}
2323

24-
section, code, h2 {
24+
div.section, code, h2 {
2525
-moz-border-radius: 12px;
2626
-webkit-border-radius: 12px;
2727
background: #FFF;

0 commit comments

Comments
 (0)