td 안에 버튼이있는 테이블이 있습니다. 버튼을 누르면 td에 텍스트가 추가됩니다. 버튼을 다시 한번 누르면이 텍스트가 제거됩니다. 이 단추는 테이블에서 여러 번 사용되므로 class 특성을 사용합니다. 이 작업을 수행하는 데 사용할 수있는 방법은 무엇입니까?JQuery 추가 실행 취소
$(document).on('click', '.releasebutton', function() { // button class="releasebutton"
var label = $(this).text();
if (label == "Add") { // it is "Add" by default
$(this).text("Cancel");
$('.ReleaseTD').append("<br>" + "test"); // td class="ReleaseTD"
}
// the code above this works
else {
$(this).text("Add");
$('.ReleaseTD').remove("<br>" + "test");
// this obviously is wrong but this is where i would like the correct code
};
});
? 나는 나의 질문을 향상시킬 것이다. – Roy123
예를 들어 와 같은 TR 번호를 삽입 한 다음 TR 번호 ID와 동일한 버튼을 통해 버튼을 눌러 데이터를 전송하는 것과 같이 고유 ID가 필요합니다. – Imphusius
http : // stackoverflow .com/a/546055/6501094 이것은 나를 위해 일했다. – Roy123