jQuery UI Datepicker refresh()方法

jQuery UI Datepicker refresh()方法

jQuery UI由使用HTML、CSS和jQuery实现的GUI部件、视觉效果和主题组成。 jQuery UI非常适合为网页建立UI界面。

在这篇文章中,我们将使用jQuery UI Datepicker refresh()方法,在进行一些外部修改后,重新绘制日期选择器。这个方法不接受任何参数。

语法:

$(".selector").datepicker("refresh");

CDN链接:首先,添加你的项目需要的jQuery UI脚本。

<link href = “https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css” rel = “stylesheet”>
<script src = “https://code.jquery.com/jquery-1.10.2.js”></script>
<script src = “https://code.jquery.com/ui/1.10.4/jquery-ui.js”></script>

例子:这个例子演示了Query UI Datepicker refresh()方法。

<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <link href=
"https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css" 
          rel="stylesheet">
    <script src="https://code.jquery.com/jquery-1.10.2.js">
    </script>
    <script src="https://code.jquery.com/ui/1.10.4/jquery-ui.js">
    </script>
  
    <!-- jQuery code -->
    <script>
        (function () {
            ("#GFG").datepicker();
  
            ("#btn").on('click', function () {
                ("#GFG").datepicker("refresh");
                alert("Widget Refreshed!");
            });
        });
    </script>
</head>
  
<body>
    <center>
        <h1 style="color: green;">
            GeeksforGeeks
        </h1>
  
        <h3>jQuery UI Datepicker refresh() Method</h3>
  
        <p>Enter Date: <input type="text" id="GFG"></p>
  
        <input type="button" id="btn" style="padding: 5px 15px;" 
               value="Refresh the Widget">
    </center>
</body>
  
</html>

输出:

jQuery UI Datepicker refresh()方法

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程