Rumah > Artikel > hujung hadapan web > laydate时间组件在火狐浏览器下有多时间输入框时只能给第一个输入框赋值的问题
遇到的问题:
laydate时间组件在火狐浏览器下有多时间输入框时只能给第一个输入框赋值的问题(safari下也有同样问题);
解决办法:
给laydate绑定id;
解决前代码:
<span style="color: #008080;">1</span> <span style="color: #0000ff;"><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 style="color: #800000;">br</span><span style="color: #0000ff;">></span> <span style="color: #008080;">4</span> <span style="color: #0000ff;"><span style="color: #800000;">br</span><span style="color: #0000ff;">></span> <span style="color: #008080;">5</span> <span style="color: #0000ff;"><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></span></span></span>
解决后代码:
<span style="color: #008080;">1</span> <span style="color: #0000ff;"><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 style="color: #800000;">br</span><span style="color: #0000ff;">></span> <span style="color: #008080;">4</span> <span style="color: #0000ff;"><span style="color: #800000;">br</span><span style="color: #0000ff;">></span> <span style="color: #008080;">5</span> <span style="color: #0000ff;"><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></span></span></span>
如上,在第2,6行增加id绑定, 问题解决;
<span style="font-family: verdana, Arial, Helvetica, sans-serif; font-size: 14px; line-height: 1.5;"> </span>