我目前正在制作一个下拉列表,其值通过表 RA 的 ID 传递,条件如下。
ID External
1 false
2 false
3 true
如何检查此 ID external == true 是否显示另一种形式:input。
有什么想法吗?
这是到目前为止我的 html 代码:
<div class="form-group">
<label>RECRUITMENT AGENCY:</label>
{!! Form::select('recruitment_agency_id', $recruitmentAgencyList, null, array('id' => 'recruitment_agency', 'class' => 'form-control')) !!}
</div>
<div class="form-group referral_by" style="display: none;">
<label>REFERRAL BY:</label>
{!! Form::text('referral_by', null, array('class' => 'form-control referral_by')) !!}
</div>
最佳答案
试试这个:
当您在浏览器上检查元素时,您的选择框 html 应该如下所示。
<select id="ddl" onchange="checktruefalse()">
<option value="false">1</option>
<option value="false">2</option>
<option value="true">3</option>
</select>
您可以在此处添加您的条件:
function checktruefalse() {
if ($("#ddl").val() == "true") {
alert("true...!!");
}
}
关于javascript - Jquery 带条件选择选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42265129/