동적 삭제 행 증가

1488 단어
js
$("#btnMinus").bind("click",function(){
		if($("#tblFlgg tr").length>2)
		{
			$("#tblFlgg tr:last").remove();
		}
		else{
			alert(' !');
		}
	});
	$("#btnAdd").bind("click",function(){
		var newRow='<tr><td><input class="standard-input" value=""></td></tr>';
		$("#tblFlgg tr:last").after(newRow);
	});

html
<div class="standard-div" id="dvFlgg" style="display:none">
				<div class="standard-table-div">
					<table class="standard-table" border="1" id="tblFlgg">
						<tr>
							<td class="standard-table-title"> </td>
						</tr>
						<tr>
							<td style=""><span class="add-btn" id="btnAdd">+</span> <span class="minus-btn" id="btnMinus">-</span></td>
						</tr>
					</table>
				</div>
				<div class="standard-bottom-div">
			<!-- 		<div class="commit-success"> </div> -->
					<div class="standard-btn-div">
						<span class="commit-btn"> </span> <span class="cancel-btn"> </span>
					</div>
				</div>

			</div>

좋은 웹페이지 즐겨찾기