Jquery getting variable value [duplicate]

Currently, you are passing an object with key iss for the rules property. What you need to do is pass an object with key issue_quant_<?php echo $array['requisition_id'];?>.

In your previous question, which is very similar to this one, I have already shown you how you can create an object with a variable key:

var iss="issue_quant_" + str;
var rules = {};
rules[iss] = {max: ma};
$("#myform").validate({
    rules: rules
});

Assuming that 'issue_quant_' + str evaluates to the value of issue_quant_<?php echo $array['requisition_id'];?>, the validation rule will be applied to the input.

Leave a Comment