Description: Makes the element require a decimal number.
Returns true if the value contains a valid decimal number.
Works with text inputs.
Makes "field" required and a decimal number only.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
<title>Makes "field" required and a decimal number only.</title>
<link rel="stylesheet" href="https://jqueryvalidation.org/files/demo/site-demos.css">
<label for="field">Required, decimal number: </label>
<input class="left" id="field" name="field">
<input type="submit" value="Validate!">
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/jquery.validate.min.js"></script>
<script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/additional-methods.min.js"></script>
jQuery.validator.setDefaults({
$( "#myform" ).validate({
|
Demo: