我正在为复选框添加功能。当复选框被选中时,我想用yes来自动填充文本框。但我无法获得功能。 任何见解高度赞赏。 下面是代码,我试着用当复选框ID检查时自动填充文本框 - Jquery
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js">
</script>
<script language="JavaScript">
$(document).ready(function()
{
$('#checkboxid').attr('checked', true) {
$("input[Title='Text Box Name']").val("Yes"); }
});
</script>
上班以下是这两个项目的HTML代码。请裸露我的HTML代码,它是Sharepoint的自动生成代码。
对于文本框和复选框
<TR><TD nowrap="true" valign="top" width="190px" class="ms-formlabel">
<H3 class="ms-standardheader">
<nobr>Text Box name</nobr>
</H3></TD><TD valign="top" class="ms-formbody" width="400px">
<div align="left" class="ms-formfieldcontainer">
<div class="ms-formfieldlabelcontainer" nowrap="nowrap">
<span class="ms-formfieldlabel" nowrap="nowrap">Text Box name</span></div>
<div class="ms-formfieldvaluecontainer"><span dir="none">
<input name="ctl00$m$g_89e4bf6d_529c_49e0_95e0_7024e4172c50$ctl00$ctl04$ctl63$ctl00$ctl00$ctl04$ctl00$ctl00$TextField" type="text" maxlength="255"
id="ctl00_m_g_89e4bf6d_529c_49e0_95e0_7024e4172c50_ctl00_ctl04_ctl63_ctl00_ctl00_ctl04_ctl00_ctl00_TextField"
title="Text Box name" class="ms-long" /><br></span></div></div></TD></TR>
<TR><TD nowrap="true" valign="top" width="190px" class="ms-formlabel">
<H3 class="ms-standardheader">
<nobr>Check Box name</nobr>
</H3></TD>
<TD valign="top" class="ms-formbody" width="400px">
<div align="left" class="ms-formfieldcontainer">
<div class="ms-formfieldlabelcontainer" nowrap="nowrap">
<span class="ms-formfieldlabel" nowrap="nowrap">Check Box name</span></div>
<div class="ms-formfieldvaluecontainer"><span dir="none">
<input id="ctl00_m_g_89e4bf6d_529c_49e0_95e0_7024e4172c50_ctl00_ctl04_ctl60_ctl00_ctl00_ctl04_ctl00_ctl00_BooleanField"
type="checkbox"
name="ctl00$m$g_89e4bf6d_529c_49e0_95e0_7024e4172c50$ctl00$ctl04$ctl60$ctl00$ctl00$ctl04$ctl00$ctl00$BooleanField" /><br>
</span></div></div></TD></TR>
感谢那些是有用的,SRY我只能接受一个答案。 – Bk8579