
[英]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.