有没有办法从 html5 日期时间选择器附带的日历弹出窗口中设置或删除此清除按钮?它没有清除我的字段,并且想删除或编辑它,因为它无法正常工作。
这里是输入的html
<label for="rowKeyStartDate">Start Date/Time: </label>
<mat-form-field appearance="outline">
<input matInput id="rowKeyStartDate" type="datetime-local" step="0.001" formControlName="rowKeyStartDate" required>
</mat-form-field>
最佳答案
Clear 按钮隐含的一种工作方式是添加一个隐藏的 <button>
元素:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Test Application</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<input id="el" type="datetime-local">
<button onclick="javascript:el.value=''" hidden></button>
</body>
</html>
关于javascript - 样式化日期时间-本地日历清除按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70365987/