
[英]i keep getting logged out even though i have set the authentication with protected routes in react/redux ? when i refresh the page
[英]A text box appears when I load the page even though I have set its “style:display” to none
<input type="text" name="otherPONumber" id="otherPONumber" maxlength="25" style="display: none;">
<script type="text/javascript">
function toggleField(val) {
var obj = document.getElementById('otherPONumber');
if(obj != undefined && txt != undefined) {
(val == 'Other')? obj.style.display = 'block' : obj.style.display = 'none';
}
}
</script>
尽管如此,当页面加载时会出现文本框。
(val == 'Other')? obj.style.display = 'block' : obj.style.display = 'none';
这种对三元运算符的滥用是可怕的。 将其替换为以下内容:
obj.style.display = (val == 'Other') ? 'block' : 'none';
如果元素在加载后立即显示,请使用 Firefox(或类似工具)检查是否有一些 CSS 规则覆盖了您的内联样式。
问题未解决?试试以下方法:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.