|
 |
|
สอบถามการใช้ input CreateNewRow เป็นรูปแบบฟอร์ม หลายๆบรรทัด |
|
 |
|
|
 |
 |
|
ลองดูตามนี้ครับ ในตัวอย่างมีบรรทัดเดียว
แต่ผมเชื่อว่าคุณ apply เองให้มีหลายบรรทัด (หลาย input เดิม) ได้ครับ
Code (PHP)
//Created by Mr.Mongkon Kaenjan
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">
$('document').ready(function(){
$('#remove').hide();
$('#addrow').click(function(){
if(($('#tb tr').size()) > 1){
$('#remove').show();
}
var no = parseInt($('#tb tr').length)+1;
$('#tb tr:last').after(
'<tr><td>'+no+'</td>'+
'<td><input type="text" id="txt" name="txt[]"></td>'+
'<td><select id="ddl" name="ddl[]">'+
'<option>--select one--</option>'+
'<option value="A">option A</option>'+
'<option value="B">option B</option>'+
'</select>'+
'</td></tr>'
);
});
$('#remove').click(function(){
$('#tb tr:last').remove();
if(($('#tb tr').size())==1){
$('#remove').hide();
}
});
});
</script>
<table id="tb">
<tr>
<td>1.</td>
<td><input type="text" id="txt" name="txt[]"></td>
<td>
<select id="ddl" name="ddl[]">
<option>--select one--</option>
<option value="A">option A</option>
<option value="B">option B</option>
</select>
<button id="addrow">Add row</button><button id="remove">Remove</button></td>
</tr>
</table>
|
 |
 |
 |
 |
Date :
2013-11-15 16:46:09 |
By :
mangkunzo |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|