Home >Web Front-end >HTML Tutorial >The problem that the laydate time component can only assign a value to the first input box when there are multiple time input boxes in Firefox browser
Problems encountered:
The problem that the laydate time component can only assign a value to the first input box when there are multiple time input boxes in Firefox (the same problem also exists in Safari);
Solution:
Bind id to laydate;
Code before solution:
<span style="color: #008080;">1</span> <span style="color: #0000ff;"><</span><span style="color: #800000;">input </span><span style="color: #ff0000;">id</span><span style="color: #0000ff;">="startTime"</span><span style="color: #ff0000;"> placeholder</span><span style="color: #0000ff;">="请输入开始时间"</span><span style="color: #ff0000;"> class</span><span style="color: #0000ff;">="laydate-icon"</span> <span style="color: #008080;">2</span> <span style="color: #ff0000;"> onClick</span><span style="color: #0000ff;">="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"</span><span style="color: #0000ff;">></span> <span style="color: #008080;">3</span> <span style="color: #0000ff;"><</span><span style="color: #800000;">br</span><span style="color: #0000ff;">></span> <span style="color: #008080;">4</span> <span style="color: #0000ff;"><</span><span style="color: #800000;">br</span><span style="color: #0000ff;">></span> <span style="color: #008080;">5</span> <span style="color: #0000ff;"><</span><span style="color: #800000;">input </span><span style="color: #ff0000;">id</span><span style="color: #0000ff;">="endTime"</span><span style="color: #ff0000;"> placeholder</span><span style="color: #0000ff;">="请输入结束时间"</span><span style="color: #ff0000;"> class</span><span style="color: #0000ff;">="laydate-icon"</span> <span style="color: #008080;">6</span> <span style="color: #ff0000;"> onClick</span><span style="color: #0000ff;">="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"</span><span style="color: #0000ff;">></span>
Code after solution:
<span style="color: #008080;">1</span> <span style="color: #0000ff;"><</span><span style="color: #800000;">input </span><span style="color: #ff0000;">id</span><span style="color: #0000ff;">="startTime"</span><span style="color: #ff0000;"> placeholder</span><span style="color: #0000ff;">="请输入开始时间"</span><span style="color: #ff0000;"> class</span><span style="color: #0000ff;">="laydate-icon"</span> <span style="color: #008080;">2</span> <span style="color: #ff0000;"> onClick</span><span style="color: #0000ff;">="laydate({elem: '#startTime', istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"</span><span style="color: #0000ff;">></span> <span style="color: #008080;">3</span> <span style="color: #0000ff;"><</span><span style="color: #800000;">br</span><span style="color: #0000ff;">></span> <span style="color: #008080;">4</span> <span style="color: #0000ff;"><</span><span style="color: #800000;">br</span><span style="color: #0000ff;">></span> <span style="color: #008080;">5</span> <span style="color: #0000ff;"><</span><span style="color: #800000;">input </span><span style="color: #ff0000;">id</span><span style="color: #0000ff;">="endTime"</span><span style="color: #ff0000;"> placeholder</span><span style="color: #0000ff;">="请输入结束时间"</span><span style="color: #ff0000;"> class</span><span style="color: #0000ff;">="laydate-icon"</span> <span style="color: #008080;">6</span> <span style="color: #ff0000;"> onClick</span><span style="color: #0000ff;">="laydate({elem: '#endTime', istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"</span><span style="color: #0000ff;">></span>
As above, add id binding in lines 2 and 6, the problem is solved;
<span style="font-family: verdana, Arial, Helvetica, sans-serif; font-size: 14px; line-height: 1.5;"> </span>