& 입력 형식을 제거하기 위해 jQuery를 다운로드했습니다.이 jQuery에 HTML 요소를 추가하려면 어떻게해야합니까?
이제 어떻게이 코드에 새 테이블을 삽입 할 수 있습니까? 당신은 단지 라벨의 추가 후 jQuery를이 코드를 추가 할 필요가
$(document).ready(function(){
var counter = 2;
$("#ctl00_mainContentPlaceHolder_btnNewRow").click(function() {
if(counter>10){
alert("Only 10 textboxes allow");
return false;
}
var newTextBoxDiv = $(document.createElement('div'))
.attr("id", 'TextBoxDiv' + counter);
newTextBoxDiv.after().html('<label>Textbox '+ counter + ' : ' +
'<input type="text" name="textbox' + counter +
'" id="textbox' + counter + '" value="" ></label>');
newTextBoxDiv.appendTo("#TextBoxesGroup");
counter++;
});
$("#removeButton").click(function() {
if(counter==2){
alert("No more textbox to remove");
return false;
}
counter--;
$("#TextBoxDiv" + counter).remove();
});
$("#getButtonValue").click(function() {
var msg = '';
for(i=1; i<counter; i++){
msg += "\n Textbox " + i + " : " + $('#textbox' + i).val();
}
alert(msg);
});
});