How can I get "Segment" column input value?
Edit
I have changed the logic, I'm adding a button to each line in the table and adding an on "click" event , in the on click function i want to use a value of one of the fields but the segmentName val() function is not returning it
function generateSetDefaultSegmentValueButton(){
$('#cust_segment_rules_sublist_default_splits tr').each(function(){
let lineIndex = this.id.replace('cust_segment_rules_sublist_default_row_','');
// console.log("lineIndex0: " + lineIndex)
$(this).find("td:contains('Button')").each(function(){
$(this).html('<button type="button" id="col_default_value_button_line_' + lineIndex + '" style = "cursor: pointer;" >Select defaul segment value</button>');
$(`#col_default_value_button_line_${lineIndex}`).on("click", {arg1: `${lineIndex}`} ,onDefaultSegmentClick);
})
})
}
function onDefaultSegmentClick(e){
let lineIndex = e.data.arg1;
let segmentName = $(`#cust_segment_rules_sublist_default_row_${lineIndex} td:nth-child(8) div`).val()
console.log("segmentName: " + segmentName)
}
Result in console: "segmentName: "
