I'm having issues with hidden & checkbox input fields. I have a set of checkboxes that the user can click. When a user selects a checkbox, I want jQuery to return the value of that particular checkbox, plus the value of the hidden form field that is next to it.
Yet, it's not as easy as I thought it would be to come up with a solution. Take the following code. CHECKBOX FIELDS <div class="review"> <input type="hidden" name="data[Request][id]" value="745" id="RequestId" /> <input type="checkbox" name="data[Request][review_id]" id="RequestReviewId" value="1" /> </div> JQUERY var review = $("#review :checkbox").val(); //VALUE OF CHECKBOX var rId = $("input:hidden[name='data[Request][id]']").fieldValue(); var zero = '0'; jQuery.each(rId, function(i, val) { alert("Index: " + i + " Value: " + val); }); Again I want the user to click on a checkbox and return the value of the checkbox which would be 1 and then the value of the hidden input field which may be 745. Then if another checkbox is selected, it would return another checkbox value plus the hidden input field which could be 746. However, I can't figure this out. The val() function only returns the first value of a matching element. The fieldValue returns all of the hidden input values. Then I tried looping thru those values but when a single box is clicked, it loops thru all of the values with the array instead of returning the specific value that is associated with that checkbox. Any assistance is greatly appreciated.