Menu ▼



Posted By :
avatarmrkraju
Total Views : 2465

jQuery datepicker get the selected date value

To get the value selected from jquery datepicker we need to use the jquery datepicker onselect event, onselect event will be having default parameter which returns the selected date. Below example will give you better idea how to do that.

Syntax:
onSelect: function (selectedDate) {
    alert(selectedDate);
}

Example:

Source Code:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <link href="http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css" rel="Stylesheet"
        type="text/css" />
    <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
    <script type="text/javascript" src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
    <script language="javascript">
        $(document).ready(function () {
            $("#txtDate").datepicker({
                onSelect: function (selectedDate) {
                    alert(selectedDate);
                }
            });
        });
    </script>
</head>
<body>
    <input id="txtDate" type="text" />
</body>
</html>





comments powered by Disqus


Search dotnetlearners.com