set value of 2nd Select based on 1st select when both select are in same column : When rows are added dynamically
Dear Sir
I have 2 "select" or dropdown in a column
based on change of 1st select , I want to set value of 2nd Select or Dropdown
-----------------------------------------------------------------------------------------------
in Jquery following staement
- $(document).on("change","select",function()
helps me to get id of 1st " select" statement
But I do not know how to set value for the second select
-----------------------------------------------------------------------------------------------------
Assuming the "select" is in 2nd column ,
i can use
- var theRow = $(this).closest("tr");
- theRow.closest('tr').find('td:eq(1) select').val(2) // 1st "select" in 2nd column i.e.eq(1)
- refer
-------------------------------------------------------------------------------------------------------
So as to set value for 2nd "Select"
I tried
- var theRow = $(this).closest("tr");
- theRow.closest('tr').find('td:eq(0) select:2').val(2);
but
it sets value for 1st Select
How to identify 2nd Select
and set value of the 2nd Select
pls help