I have make a demo in which I make rows with ids tc_1
, tc_2
, tc_3
…… and so on.
When I expand a row, I have two options and a button. I need to get know which row id and which option is selected?
Example: I expand second row, It should alert tc_1
with option select Add test case.
$('#list').on('click','.addClickClass',function(){
alert('hii')
});
To get the row id and the value of checked radio, use this:
$('#list').on('click','.addClickClass',function(){
alert($(this).parents('li[id*="tc"]').attr('id') + "\n"
+ $(this).parents('.ui-collapsible').find('input:checked').val())
})
It gives you output like this, for example:
tc_1
TestCommand
which I believe is exactly what you're looking for.
I used this to fetch the row id:
$(this).parents('li[id*="tc"]').attr('id')
and this to get the checked radio value:
$(this).parents('.ui-collapsible').find('input:checked').val()
Both related to the clicked Add button.
See it in action here: http://jsfiddle.net/R2DzV/16/
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments