我已经切换了很多论坛并使用了建议的方法,但它似乎不起作用。所以我正在寻找第二双眼睛来帮助我发现我做错了什么。
这是一个生成表单的 cms,我只是在编写一个脚本来完成其余的工作。根据用于 jQuery 的 cms,我可以互换名称和 id。下面将显示我的 jQuery 代码,然后是我要操作的部分。表单已经禁用了文本框,只是在选择选项后不会重新启用它。
<script type="text/javascript">
$(document).ready(function()
{
$("input:text[name=Other]").attr("disabled", true);
$("select[name=School[]]").change(function()
{
var chk= $(this).val();
if (chk == 'Other')
{
$("input:text[name=Other]").attr("disabled", false);
}
});
});
</script>
<form id="ouforms" name="ouforms" method="post" class="ldpforms">
<select name="School[]">
<option value="PleaseSelect" checked="checked">(Please Select)</option>
<option value="BeachPublicSchools">Beach Public Schools</option>
<option value="BelfieldPublicSchools">Belfield Public Schools</option>
<option value="BillingsCountyPublicSchools">Billings County Public Schools</option>
<option value="BowmanCountyPublicSchools">Bowman County Public Schools</option>
<option value="DakotaHorizonYouthCenter">Dakota Horizon Youth Center</option>
<option value="DickinsonAdultLearningCenter">Dickinson Adult Learning Center</option>
<option value="DickinsonCatholicSchools">Dickinson Catholic Schools</option>
<option value="DickinsonStateUniversityStudents">Dickinson State University Students</option>
<option value="EarlyChildhoodLeft">Early Childhood Left</option>
<option value="GlenUllinPublicSchools">Glen Ullin Public Schools</option>
<option value="HallidayPublicSchools">Halliday Public Schools</option>
<option value="HebronPublicSchools">Hebron Public Schools</option>
<option value="HettingerPublicSchools">Hettinger Public Schools</option>
<option value="HopeChristianAcademy">Hope Christian Academy</option>
<option value="KilldeerPublicSchools">Killdeer Public Schools</option>
<option value="LoneTreeGolvaPublicSchools">Lone Tree (Golva) Public Schools</option>
<option value="MottRegentPublicSchools">Mott/Regent Public Schools</option>
<option value="NewEnglandPublicSchools">New England Public Schools</option>
<option value="RichardtonTaylorPublicSchools">Richardton Taylor Public Schools</option>
<option value="ScrantonPublicSchools">Scranton Public Schools</option>
<option value="SouthHeartPublicSchools">SouthHeart Public Schools</option>
<option value="SWCHS">SWCHS</option>
<option value="TwinButtesPublicSchools">Twin Buttes Public Schools</option>
<option value="WestRiverSpecialServices">West River Special Services</option>
<option value="Other">Other</option>
</select>
<br/>
<label for="Other">Other: </label>
<input type="text" name="Other" value=""/>
</form>