ช่วยทีครับ ผม clone() แล้ว count โผล่แค่ 1 ครับ $(function(){ $(#addRow).click(function(){ $(#tbl1).append($(#firstTR).clone()); }); $(#removeRow).click(function(){
ถาม-ตอบ แนะนำไอเดียว โค้ดตัวอย่าง แนวทาง วิธีแก้ปัญหา ช่วยทีครับ ผม clone() แล้ว count โผล่แค่ 1 ครับ $(function(){ $(#addRow).click(function(){ $(#tbl1).append($(#firstTR).clone()); }); $(#removeRow).click(function(){
ช่วยทีครับ ผม clone() แล้ว count โผล่แค่ 1 ครับ $(function(){ $(#addRow).click(function(){ $(#tbl1).append($(#firstTR).clone()); }); $(#removeRow).click(function(){
Copy
อันนี้ตัว code ที่ clone ครับ
$("#addRow").click(function(){
$("#tbl1").append($("#firstTR").clone());
});
$("#removeRow").click(function(){
if($("#tbl1 tr").size()>1){
$("#tbl1 tr:last").remove();
}else{
alert("ต้องมีรายการข้อมูลอย่างน้อย 1 รายการ");
}
});
});
ส่วนอันนี้คือตัวที่ผมจะ clone คับ
<table width="100%" border="0" cellspacing="0" cellpadding="4" class="main" id="tbl1">
<tr>
<td width="176" rowspan="2" align="center" class="border_4">Academy</td>
<td rowspan="2" colspan="2" align="center" class="border_4">Degree</td>
<td colspan="2" align="center" class="border_4">Year Att</td>
<td width="57" rowspan="2" align="center" class="border_4">GPA.</td>
</tr>
<tr>
<td width="135" align="center" class="border_2 border_4">start</td>
<td width="128" align="center" class="border_2 border_4"><pre>graduate</pre></td>
</tr>
<tr id="firstTR" align="center">
<td class="border_2 border_4"><input type="text" name="academy[]" class="main" style="width:150px;" /></td>
<td width="152" class="border_2 border_4"><span class="border_4">
<select name="degree[]" class="style7" style="width:150px;">
<?
$sel7="select * from degree ";
$que7=mysql_query($sel7);
while($read7=mysql_fetch_array($que7)){
?>
<option value="<?=$read7['deg_id'];?>"><?=$read7['deg_desc'];?></option>
<? } ?>
</select>
</span></td>
<td width="150" class="border_2 border_4"><input type="test" name="degreedesc[]" class="main" style="width:150px;" /></td>
<td class="border_2 border_4"><span class="border_2 border_4">
<input type="month" name="start[]" class="main" style="width:120px;" />
</span></td>
<td class="border_2 border_4"><span class="border_2 border_4">
<input type="month" name="graduate[]" class="main" style="width:120px;" />
</span> </td>
<td class="border_2"><input type="text" name="gpa[]" style="width:50px;"/> </td>
</tr>
</table>
แล้วมันก็ clone ได้ครับ แต่ปัญหาคือผมลอง count ตอนที่ส่งค่าไปอีกหน้านึงดูผม echo count($_POST[academy]); ดูมันออกแค่ 1 อ่าครับผม ผมต้องทำไงดีครับ ขอรบกวนด้วยครับพี่ ผมมือใหม่จริงๆครับ T^T
คำแนะนำ และการใช้งาน
สมาชิก กรุณา ล็อกอินเข้าระบบ เพื่อตั้งคำถามใหม่ หรือ ตอบคำถาม สมาชิกใหม่ สมัครสมาชิกได้ที่ สมัครสมาชิก
- ถาม-ตอบ กรุณา ล็อกอินเข้าระบบ
เว็บไซต์ของเราให้บริการเนื้อหาบทความสำหรับนักพัฒนา โดยพึ่งพารายได้เล็กน้อยจากการแสดงโฆษณา
โปรดสนับสนุนเว็บไซต์ของเราด้วยการปิดการใช้งานตัวปิดกั้นโฆษณา (Disable Ads Blocker) ขอบคุณครับ