Heim > Artikel > Web-Frontend > Das Problem, dass die Laydate-Zeitkomponente nur dem ersten Eingabefeld einen Wert zuweisen kann, wenn im Firefox-Browser mehrere Zeiteingabefelder vorhanden sind
Aufgetretene Probleme:
Das Problem, dass die Laydate-Zeitkomponente nur dem ersten Eingabefeld einen Wert zuweisen kann, wenn in Firefox mehrere Zeiteingabefelder vorhanden sind (dasselbe Problem besteht auch unter Safari);
Lösung:ID an Laydate binden;
Code vor Lösung:
<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>
<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>
<span style="font-family: verdana, Arial, Helvetica, sans-serif; font-size: 14px; line-height: 1.5;"> </span>