This is going to resolve to all matching elements:
$remarks = $(".remarks");
You're doing that once when the page loads and then always operating on all of those elements. Instead, remove that line completely and find the specific element you're looking for when the event happens, using the source of the event as a starting point.
Perhaps something like this:
$error_type.on("change", function(){
var $remarks = $(this).closest("tr").find(".remarks");
});
The idea is that when the change
event happens, you start from this
(which is the element that triggered the event), traverse the DOM to a common parent element (given your HTML that's likely a <tr>
), then finds the specific target .remarks
element(s) contained specifically within that parent.
Post a Comment for "Dependent Dropdown Not Working Inside While Loop"