i have code blow to change new id for a element with jquery.
$('.trclick').click(function(){
var id = $(this).attr('id');
var idright = split_right(id,'__');
var val = $('#ims_master_test_day1__'+idright).val();
$('#ims_master_test_day').attr( 'id', 'ims_master_test_day__' + idright );
});
It work but it active only one. Please help me. Thanks!
I’m going to assume you mean “it only functions the first time it’s called” when you say “It work but it active only one.” The reason for that is this line of code:
You’re getting the element by its id, but then changing it. It doesn’t work the second time because the element no longer has that id. You can fix it by doing something like this: