2009-12-04 2 views
0

코드에 어떤 문제가 있습니까?No 버튼을 클릭했을 때 <tr>이 삭제되지 않는 이유는 무엇입니까?

$('<tr><td><input type="button" value="No" /></td></tr>') 
.appendTo('table') 
.find('input[type=text]') 
.select() 
.end() 
.find("input[type='text'][value='No']") 
.click(function() {$(this).parents('tr').remove();}) 
+0

마크 업을 게시하시기 바랍니다. – yoda

+0

은 'input [type ='button ']'이 아니어야합니까? 두 번째 찾기에 대한 이유는 보이지 않지만 선택하거나 끝내십시오. – falstro

답변

2

선택자에서 유형 = 텍스트를 선택하고 있습니다. 유형 = 버튼으로 변경하십시오.

$('<tr><td><input type="button" value="No" /></td></tr>') 
.appendTo('table') 
.find('input[type=button]') 
.select() 
.end() 
.find("input[type='button'][value='No']") 
.click(function() {$(this).parents('tr').remove();}) 
+0

그는 테이블에이를 추가하여 실제로 존재할 수 있습니다. – yoda

+0

아니요, 타이핑 .... – user198729

관련 문제