我有我的添加和刪除功能如下:更新輸入字段動態的javascript jquery的
function AddOtherRefDoc(name, number) {
var remove = "<a href='javascript:void(0);' onclick='removeRefDoctor(this)'>Remove</a>";
var html = "<li><b> Referral Doctor: </b>"+name+"<b>, Referral No: </b>"+number+ " " +remove+"</li>";
opener.jQuery("#r_docs").append(jQuery(html));
}
function removeRefDoctor(el) {
var el = jQuery(el);
if (el) { el.parent().remove(); }
else { alert("Unable to remove recipient."); }
}
的removeRefDoctor功能刪除當前的元素,但我的輸入欄沒有更新。我如何更新以下輸入字段?
<ul id="r_docs" >
<% StringTokenizer rdlist = new StringTokenizer(rd,";");
StringTokenizer rdnolist = new StringTokenizer(rdohip,";");
while (rdlist.hasMoreTokens() && rdnolist.hasMoreTokens()) {
String rd_split = rdlist.nextToken();
String rdno_split = rdnolist.nextToken(); %>
<li>Referral Doctor: <%=rd_split%><b>, Referral No: </b><%=rdno_split%> <a href='javascript:void(0);' onclick='removeRefDoctor(this)'>Remove</a></li>
<%} %>
<input id="r_doctor" type="hidden" name="r_doctor" size="150" value="<%=rd%>">
<input id="r_doctor_ohip" type="hidden" name="r_doctor_ohip"
size="60" value="<%=rdohip%>">
</ul>
你是什麼意思「更新輸入欄」?你是否試圖在該字段中插入一個值? – jessegavin 2011-04-26 17:19:59
@jessegavin - 是的我試圖將值嵌入隱藏的輸入字段。例如,r_doctor是一個字符串,其中包含由「;」分隔的醫生列表。 – Sapphire 2011-04-26 17:48:16