標(biāo)簽在HTML5中新增了color, date, datetime, datetime-local, month, week, time, email, number, range, search, tel 以及 url新屬性。
本篇記錄在開發(fā)中使用date屬性,遇到的一些問題,以及功能擴(kuò)展:
html:
js:
利用標(biāo)簽屬性實現(xiàn)
max:可選最大日期
min:可選最小日期
js設(shè)置最大只能選擇到當(dāng)前日期
html
js
移動端顯示問題
當(dāng)移動端使用nput[type="date"]時 ios系統(tǒng)日歷格式是這樣 ===> 2019年06月06日
樣式上安卓和ios不統(tǒng)一
為了實現(xiàn)樣式統(tǒng)一可以利用input[type="text"]代替日歷控件,顯示選擇的日期
html
css
/* 日期控件樣式 */ .date-input-box{ position: relative; display: inline-block; } .data{ width: 100px; height: 24px; padding: 0 5px; line-height: 24px; } .dateInput{ position: absolute; left: 0;right: 0; z-index: 10; opacity: 0; } .selectIcon { position: absolute; top: 50%; transform: translateY(-50%); right: 10px; width: 3px; height: 0; border-top: 4px solid #999; border-left: 4px solid transparent; border-right: 4px solid transparent; z-index: 8; }
js
將 " - " 替換成 "/ "
//dataInput=dataInput.replace(/-/g,"/");
文章版權(quán)歸作者所有,未經(jīng)允許請勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請注明本文地址:http://systransis.cn/yun/54034.html
標(biāo)簽在HTML5中新增了color, date, datetime, datetime-local, month, week, time, email, number, range, search, tel 以及 url新屬性。本篇記錄在開發(fā)中使用date屬性,遇到的一些問題,以及功能擴(kuò)展: 獲取當(dāng)前日期,并顯示在input[type=date]上 html: js: $(function(...
標(biāo)簽在HTML5中新增了color, date, datetime, datetime-local, month, week, time, email, number, range, search, tel 以及 url新屬性。本篇記錄在開發(fā)中使用date屬性,遇到的一些問題,以及功能擴(kuò)展: 獲取當(dāng)前日期,并顯示在input[type=date]上 html: js: $(function(...
fastclick.js?bf9a:331 Uncaught DOMException: Failed to execute setSelectionRange on HTMLInputElement: The input elements type (number) does not support selection 解決方法: 找到node_module中的文件fastclick.js, l...
閱讀 2987·2021-09-22 15:18
閱讀 3405·2019-08-30 15:54
閱讀 3284·2019-08-30 15:53
閱讀 606·2019-08-30 14:12
閱讀 826·2019-08-29 17:01
閱讀 2213·2019-08-29 14:04
閱讀 1405·2019-08-29 13:09
閱讀 875·2019-08-26 17:40