6
블록 요소를 삽입하려고합니다. 다른 요소를 삽입하십시오. 올바른 방법을 사용하고 있는지 확실하지 않지만 여기에는 제 코드가 있습니다. 너희들도 도울 수 있길 바래. 감사!Jquery 전에 요소를 삽입하십시오. <tr>
jQuery를
$("#addMatch").click(function(){
$("<td>New insert</td>").insertBefore("#addMatch").closest('tr');
return false; //this would insert the <td>New insert</td> before the
//<td><input type="button" id="addMatch" name="addMatch" value="Add
//Match" </td> but not <tr>
});
HTML은
<tr>
<td>some data</td>
</tr>
//can't tell how many tr would show before the last "addMatch" button. It's dynamic.
// I want the <td>New insert</td> show up here.
<tr>
<td><input type="button" id="addMatch" name="addMatch" value="Add Match" </td>
</tr>
을 대신 .parents'의 ('TR : 첫 번째')','.closest ('TR') '있다 : –
빠른 .closest입니다 ? –
좋습니다. 감사! 네, 가장 가까운 것이 더 빠르다고 생각합니다. – FlyingCat