I'm going to suggest that you mean "it only works the first time it is called" when you say "It works, but it is only active one." The reason for this is this line of code:
$('#ims_master_test_day').attr( 'id', 'ims_master_test_day__' + idright );
You get the element by its identifier, but then change it. This does not work a second time because the item no longer has this identifier. You can fix this by doing something like this:
var test_day = $('#ims_master_test_day')
$('.trclick').click(function(){
var id = $(this).attr('id');
var idright = split_right(id,'__');
var val = $('#ims_master_test_day1__'+idright).val();
test_day.attr( 'id', 'ims_master_test_day__' + idright );
});
source
share