我想在点击事件中将div标签动作复制到输入框。在div标签中显示日历。
<div id="datepicker"></div>
<input id="datepicker" type="date" name="sample">
<script src="external/jquery/jquery.js"></script>
<script src="jquery-ui.js"></script>
<script>
$("#datepicker").datepicker({
inline: true
});
</script>
答案 0 :(得分:1)
只需在点击事件上显示datepicker,如下所示:
<div id="datepickerContainer"> <!---- ID should be unique ---------->
</div>
<input id="datepicker" type="date" name="sample">
<script src="external/jquery/jquery.js"></script>
<script src="jquery-ui.js"></script>
<script>
$( "#datepicker" ).datepicker({
inline: true
});
$('#datepickerContainer').on('click',function() {
$( "#datepicker" ).datepicker('show');
});
</script>