드롭 다운 목록의 값 (옵션)을 다른 드롭 다운 목록으로 복사하려고합니다. 사용자가 추가 버튼을 클릭 할 때마다 새 테이블 행에 여러 텍스트 상자와 원본의 사본 인 드롭 보관함이 추가됩니다. 벨로 우어가 내 코드 :하나의 드롭 다운 옵션을 다른 것으로 복사 할 수 없습니다.
$(function(){
$("#addBtn").click(function(){
var rows = $("#nofRowHidden").val();//get the current no of row
rows++;
$("#crsTable").append(
'<tr>'+
'<td><input type="text" name="assesmntNameTxtBx'+rows+'"/></td>'+
'<td><input type="text" name="markRcvdTxtBx'+rows+'"/></td>'+
'<td><input type="text" name="totalTxtBox'+rows+'"/></td>'+
'<td>'+
'<select name="drpDwnCrs'+rows+'">'+
'</select>'+
'</td>'+
'</tr>'
);
//#drpDwnCrs1 was original drbdwn and populated with data from the database
$("#drpDwnCrs1 option").clone().appendTo("#drpDwnCrs"+rows);
$("#nofRowHidden").val(rows);//add current no of row to hidden txt bx
});
});
위 코드는 텍스트 상자가있는 새 행을 올바르게 생성합니다. 그러나 드롭 다운 목록의 값을 복사하지 못합니다.
감사합니다.
이드의 실수를 지적 해 주셔서 감사합니다. 위에서 언급 한 방법을 시도했지만 작동하지 않았습니다. 그래서 나는 그 아이를 위해 이드를 만들었다. 감사. – Sas