I'm having trouble figuring out how to make the validation plugin to validate my dynamically created input fields in the form. And yes, I have searched around, so far I can't find any answer that solves my problem. So here it is me asking.
Demo
: http://jsfiddle.net/MGbWx/
What I'm trying to do is make item price in the first row required. The newly cloned rows should only make item price required when there is input in one of the other three input fields.
I tried the following.
var itemPropSelector = 'input[name="sku[]"], input[name="itemVariant[]"], input[name="itemQuant[]"]';
$('#item-prop-wrapper').on('keyup', itemPropSelector, function () {
$(this).closest('.item-prop-body').find('.item-price-input').rules('add', {
required: true
});
});
But it doesn't work as what I expect. I've been struggling with this for hours...
Can anyone help me on this? I appreciate it!!