I have a table where email Inbox is shown in it (please see excerpt ss here ).
When user clicks on checkbox, I should populate 2 dropdowns with proper items.
function fnHandleSelectCBClick(cb) {
try {
var tableRow = $(cb).parent().parent();
// Here I should be able to find control ids of other 2 dropdown in the table row.
// Tried below code and failed
//var propSelect = $(cb).parent().parents('tr:first').find('select');
//var taskSelect = $(cb).parent().parents('tr:second').find('select');
} catch (e) {alert(e);}
}
Here is the table row structure screenshot.
If I can get their ids, I can directly fill items and then later it can validated too.
I am a beginner javascript and jQuery. Please correct if I am wrong anywhere.
You have not shown the full html for table and button, so you may need to adjust this based on id's, class names etc.
$('#YourTableID').on('click', 'button', function() {
var row = $(this).closest('tr');
var selects = row.find('select');
var first = selects.first(); // this is the first select
var second = selects.last(); // this is your second select
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.