时间:2020-11-27 10:45:02 | 栏目:JavaScript代码 | 点击:次
<input id="startDate" value="" readonly="true" type="text" style="cursor: pointer" class="user_datepicker "> <input class="canlderImg" data-tag="start" type="image" src="../../i/canlder1.png"> <span>结束:</span> <input id="endDate" value="" readonly="true" type="text" style="cursor:pointer;" class="user_datepicker"> <input class="canlderImg" data-tag="end" type="image" src="../../i/canlder1.png" >
// js代码
$("#startDate").datepicker(); $("#endDate").datepicker(); //点击图片弹出日历控件则需要给图片绑定点击事件 $(.canlderImg).on("click",function(e){ var tag=$(e.target).attr("data-tag"); if(tag=="start"){ $("#startDate").datepicker( "show" ); }else if(tag=="end"){ $("#endDate").datepicker( "show" ); } });