[英]HTML // CSS // JavaScript : button or input doesn't show up on web
我的表單使用基於用戶文本輸入的一些邏輯條件。 我為條件編寫了JavaScript函數,並在用戶在文本字段中鍵入內容后決定在用戶單擊按鈕時執行此函數。 當我在Brackets.io的實時預覽中運行代碼時,按鈕可見。 但是,當我在網絡上打開.html文件時,按鈕沒有顯示。
我嘗試使用帶有type =“ submit”的<input>
使其成為按鈕,但這也沒有顯示。
HTML:
<button id="funcCond">Proceed</button>
CSS:
button {
position: fixed;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -300%);
transform: translate(-50%, -300%);
display: block;
width: 70vw;
opacity: 0;
pointer-events: none;
transition: all 0.5s cubic-bezier(0.4, 0.25, 0.8, 0.3);
}
嘗試:
<button type="submit" id="funcCond">proceed</button>
要么:
<input type="button" value="proceed"/>
..並確保將不透明度值修改為1
嘗試將(type)屬性添加到html按鈕<button type="button" id="funcCond">proceed</button>
或者將輸入元素與按鈕類型<input type="button">
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.