80
rated 0 times
[
81]
[
1]
/ answers: 1 / hits: 16814
/ 9 Years ago, thu, october 1, 2015, 12:00:00
I tried the script of http://jqueryvalidation.org/max-method/.. with examples of static values. how to use the max value but dynamic?
I tried with this script but it did not work
jQuery.validator.setDefaults({
debug: true,
success: valid
});
$( #myform ).validate({
rules: {
field: {
required: true,
max: #field1 //from field1 dynamic value???
//max: 23 //static value
}
}
});
<script src=http://code.jquery.com/jquery-1.11.1.min.js></script>
<script src=http://jqueryvalidation.org/files/dist/jquery.validate.min.js></script>
<script src=http://jqueryvalidation.org/files/dist/additional-methods.min.js></script>
<form id=myform>
<lable>value1 : </lable>
<input type=text class=left id=field1 name=field1><br>
<lable>no greater than value1 : </lable>
<input type=text class=left id=field name=field>
<br/>
<input type=submit value=Validate!>
</form>
how to work?
More From » jquery