I need some pointer here. I am trying to set the value of multiple input text within a class by its index value. The extra validate class is just for inline form validation and I think it is not the problem.
I was able to access multiple check boxes within a class using the same method but I can't figure this one out. Can someone please give me a hint as to what I did wrong? Thank you.
Script
//--(4) Load Delivery Cost Input Box
var tmpstr = $('#editDeliveryCost').html();
if (tmpstr != ""){
var tmparray = tmpstr.split(',');
for (i = 0; i < tmparray.length; ++i) {
$('.typeDeliveryCost:eq('+(tmparray[i]-1)+')').val(tmparray[i]);
}
HTML
<input type="text" name='cost[]' id='inp01' class="validate[required,custom[price]] typeDeliveryCost" />
<input type="text" name='cost[]' id='inp02' class="validate[required,custom[price]] typeDeliveryCost" />
<input type="text" name='cost[]' id='inp03' class="validate[required,custom[price]] typeDeliveryCost" />
<input type="text" name='cost[]' id='inp04' class="validate[required,custom[price]] typeDeliveryCost" />
tmpstr? How about a demo? Side note, you should really be more consistent with using single/double quotes in both markup (delimiting attributes) and in JS (delimiting strings).