如何在不使用触发器的情况下打开带有标签的日期选择器?

问题描述 投票:-1回答:1

我正在尝试更改按钮的工作方式。我希望<input type = "submit">的行为与<button>的代码相同,而<button>的行为与<input type = "submit">相同。如果我知道如何使用<button> </button>标签打开日期选择器,我想可以将其反转。

<!DOCTYPE html>
<html>
<body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.12.0/moment.js"></script>
<style type="text/css">
  .back{
    background: #000;
    font-weight: 700;
    font-size: 50px;
    color: #fff;
  }
</style>
<script type="text/javascript">

$(document).ready(function(){
    //type submit
    $( "#datepicker" ).datepicker();
    //type submit

    //Click buttom
    $("#div1").click(function() {
        $("#datepicker").datepicker("show");
    });
    //Click buttom
});
</script>

<link href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.css" rel="stylesheet"/>

<button id="div1" >13/04/2020</button>
<br>
<br>
<input type="submit" id="datepicker" value="CAMBIAR FECHA">
<!-- <input type="submit" id="open-datepicker" value="cambiar fecha"> -->
</body>
</html>
javascript jquery html css jquery-ui
1个回答
0
投票

尚不清楚您遇到的问题或您要解决的问题。您可能需要考虑以下内容。

© www.soinside.com 2019 - 2024. All rights reserved.