I have a table showing records from database. There is a dropdown for selecting a particular user in each row. On change, it should show the corresponding values of the new user.
When I'm selecting a particular user from the dropdown, it should match the col1 and col2 value with the user selected and return col3 value. What I want is to get the col1 and col2 value of that particular row. How can I do it ? Please help me.
You want to use live('click', function()
. This will apply on dynamically created elements.
For example, you may try something like;
$('#your_table_id .some_class_in_a_row_to_click').live('click', function(){
$(this).siblings().each(function(){
var column = $(this).find('.some_class_for_column_with_data');
var data = column.text();
alert(data);
});
});
You may apply this on a table having some columns. Clicking on some column with class some_class_in_a_row_to_click
will alert text on another column in that row having class some_class_for_column_with_data
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.