我的代码有什么问题?它没有显示我的期望。这是我的代码:
$(document).ready(function(){
...
$('input[name=hdr_approval]').change(function(){
if($('input:radio[name=hdr_approval]')[0].checked == true){
$('#stage-action').css('display', 'block');
}else{
$('#stage-action').css('display', 'none');
}
});
if($('input[name=hdr_approval]:checked').length > 0 || $('#stage').val() === 'Personal Qualification Data'){
$('#stage-action').css('display', 'block');
console.log(document.getElementById("stage").value);
}else{
$('#stage-action').css('display', 'none');
}
console.log(document.getElementById("stage-action").style.display);
...
});
这是我页面的一部分:
<div class="col s6 m6 l6 body-reset">
<div class="right-align col s11 body-reset" style="height: inherit !important;">
<p id="stage-text" class="custom-stage-text" style="height: inherit !important; top: 0px !important; padding-top: 0px; margin-top: 0px; ">
@switch($application->stage)
@case('Credential Review')
{{ 'Personal Qualification Data' }}
@break
@case('Personal Qualification Data')
{{ 'Proceed to Qualifying Exam' }}
@break
@endswitch
</p>
</div>
<div class="right-align col s1">
<button type="submit" id="stage-action" name="action_submit" form="lt-edit-form" class="btn-flats box"><i class="fas fa-chevron-circle-right"></i></button>
</div>
</div>
默认情况下,我的stage-action
显示设置为无。
我的日志正在输出应该执行的操作,但是我不知道为什么stage-action
没有显示在页面上。