$('#AddMoreErrors,#AddMoreMime,#AddMoreRemote').live('click',function(){
var newRow = $(this).closest('tr');
$(this).closest('tr').after('<tr class="'+newRow.attr('class')+'">'+newRow.html()+'</tr>').find('span').removeAttr('id').addClass('removetr').html('Del');
});
위의 jquery 코드는 다음과 같습니다. 누군가가 "추가"를 클릭하면 가장 근접한 tr
을 찾아서 tr
에 복제하고 첫 번째 것에 추가합니다. 그런 다음 span
을 모두 찾은 다음 id
을 제거하고 새 class
을 추가하고 텍스트를 변경합니다.누군가이 jQuery 코드를 설명하는 데 도움을 줄 수 있습니까?
지금 무슨 일이 나에게 내가 span
에 removeAttr
을 할 수있는 알고 find('span').removeAttr('id').addClass('removetr').html('Del');
했다 놀라게하지만 어떻게 addClass
및 html
도 span
에 적용 되었나요?
잠깐 ... 그래서 당신은 ** 당신이 쓰고있는 ** 전혀 몰랐습니다 **? – BoltClock
나는 다른 아이디어를 가지고 있었지만 이것이 효과가있을 것이라고 생각했다.하지만 처음 촬영했을 때 놀랐다. – aWebDeveloper
오, 괜찮아. – BoltClock