일부 동적 동작을 추가하는 형식이 있습니다. 나는 신청자가 신청 한 위치의 행을 가지고있는 테이블을 가지고 있습니다. 제공 버튼이 있으며 제공 버튼을 클릭하면 제출 및 업데이트 할 제안 필드를 삽입하려고합니다. 삽입 할 feilds 얻을 수 있지만 트랜잭션 취소 단추를 클릭하면 폼을 빌드 할 div addapptrans 비우기 가져올 수 없습니다. 아래는 코드입니다. 나는 그것이 내가 놓치고있는 간단한 무엇인가 일 것임에 틀림 없다라는 것을 알고있다. 여기Jquery가 div를 제거하지 못합니다
<head>
<script type="text/javascript">
$(function(){
$(".offerposition").click(function(){
var row = $(this).closest('tr').find('td:nth-child(1)').text();
alert('You clicked on ' +row);
$("#addapptrans").empty();
$("#addapptrans").append(
$("<input>").attr('type','hidden').attr('value',row).attr('Name','Mchposid'))
.append(
$("<input>").attr('type','submit').attr('value','Complete Offer').attr('id','completeoffertrx').attr('name','completeoffertrx').addClass("buttonlarge buttonmargin")
).append(
$("<input>").attr('type','button').attr('value','Cancel Transaction').attr('id','canceloffertrx').attr('name','canceloffertrx').addClass("buttonlarge buttonmargin")
);
}
)
}
);
$(function(){
$("#canceloffertrx").click(function(){
$("#addapptrans").empty();
})
})
</script>
</head>
<body>
<form >
<div id="addapptrans"></div>
<p class="posttitle">Positions applied For</p>
<table class="tabpositions">
<tbody>
<tr>
<th class="position">Position</th>
<th class="department">Department</th>
<th class="dateapp">Date Applied</th>
<th class="appdate">Offer?</th>
</tr>
<tr>
<td style="display: none;">2281</td>
<td>Building Service Worker - Part time</td>
<td>Environmental Services</td>
<td>08/13/2001</td>
<td><input type="button" class="offerposition" value="Offer Position"></td>
</tr>
</tbody>
</table>
</form>
피들링을 제공 할 수 있습니까? – GSaunders