动态更新输入字段 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>
I have my add and remove functions as follows:
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."); }
}
The removeRefDoctor function removes the current element but my input field doesn't get updated. How can I update the following input fields?
<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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你的问题有点令人困惑...但无论如何...将值插入隐藏字段...
html
js
your question is a little bit confusing... but here goes anyways... to insert a value into a hidden field...
html
js