我已尝试将此代码段实施到我的网页中,由于某些原因,按钮没有响应,并且在点击时无法在active / notActive之间切换。它在我的jsFiddle中运行良好,但相同的代码在我的网页上不起作用。我有适当的JQuery和Bootstrap导入,因为我的表单的其余部分使用使用这些框架的工具并且正常工作。什么可能出错?这是小提琴 http://jsfiddle.net/collint25/4pq266cz/。我不会发布JavaScript或CSS,因为它可以从小提琴中逐字复制。
<div class="form form-horizontal">
<div class="panel panel-success">
<div class="panel-heading">Submitter's Information</div>
<div class="panel-body">
<div class="form-group">
<label for="subName" class="col-sm-3 control-label">Name:</label>
<div class="col-sm-8">
<input type="text" class="form-control" name="subName" id="subName" value="<?php echo $name ?>" maxlength="50" readonly="readonly" required>
</div>
</div>
<div class="form-group" style="display: none">
<label for="subTitle" class="col-sm-3 control-label">Title:</label>
<div class="col-sm-8">
<input type="text" class="form-control" name="subTitle" id="subTitle" placeholder="Title" value="<?php echo $title ?>" maxlength="50" required>
</div>
</div>
<div class="form-group" style="display: none">
<label for="subDept" class="col-sm-3 control-label">Department:</label>
<div class="col-sm-8">
<input type="text" class="form-control" data-validation="required" name="subDept" id="subDept" placeholder="Department:" value="<?php echo $department ?>" maxlength="20">
</div>
</div>
<div class="form-group" style="display:none;">
<label for="subGUID" class="col-sm-3 control-label">AU Email/GUID:</label>
<div class="col-sm-8">
<input type="text" class="form-control" name="subGUID" id="subGUID" data-validation="email" data-validation-error-msg="You did not enter a valid e-mail" value="<?php echo $wouserid . "@auburn.edu" ?>" maxlength="50">
</div>
</div>
<div class="form-group">
<label for="subPhone" class="col-sm-3 control-label">Phone Number:</label>
<div class="col-sm-8">
<input type="text" class="form-control" data-validation="required" name="subPhone" id="subPhone" placeholder="Phone Number" value="<?php echo $phone ?>" maxlength="20">
</div>
</div>
<div class="form-group">
<label for="subSupervisor" class="col-sm-3 control-label">Are you the Nominee’s Direct Supervisor?</label>
<div class="col-sm-8">
<div class="input-group">
<div id="radioBtn" class="btn-group">
<a class="btn btn-primary btn-sm active" data-toggle="happy" data-title="Y">YES</a>
<a class="btn btn-primary btn-sm notActive" data-toggle="happy" data-title="N">NO</a>
</div>
<input type="hidden" name="happy" id="happy">
</div>
</div>
</div>
</div>
</div>
</div>