We help IT Professionals succeed at work.

My jQuery Date Picker's not working

curiouswebster
on
I have added the necessary javascript file (I think) and the CSS as well, for now into the same folder as jquery-ui.js. But when I click the control the calendar is not opening.

Does anyone have any ideas about why not?


Thanks!
Comment
Watch Question

Multitechnician
CERTIFIED EXPERT
Distinguished Expert 2019
Commented:
double check the pathes in your page source (use firebug if needed looking for 404 errors)
put your code working on field inside a function waiting for total page loading

$(document).ready(function() {

// your init code here

})
curiouswebsterSoftware Engineer

Author

Commented:
Still not working...

I have this at the bottom of my cshtml file

<script>
    $(document).ready(function () {
        $(function () {
            $("#datepicker").datepicker({});
        });
    });
</script>

I have this right about the above script section:
<script defer src="@Url.Content("~/PublishedContent/js/libs/juery-ui.js")"></script>            

BUT, Visual Studio claims the file is not found. However, I see the file in my Visual Studio Solution at that address AND I see the file in Windows Explorer in the folder location.

Also, I have this field defined:
                    <div class="ui-datepicker">
                        <p>jQuery-ui Date Picker: <input type="text" id="datepicker"></p>
                    </div>
curiouswebsterSoftware Engineer

Author

Commented:
MISPELLED filename:
<script defer src="@Url.Content("~/PublishedContent/js/libs/juery-ui.js")"></script>
curiouswebsterSoftware Engineer

Author

Commented:
The path was the problem. Thanks!
leakim971Multitechnician
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
remove in bold

 $(document).ready(function () {
       $(function () {
            $("#datepicker").datepicker({});
       });
    });


>BUT, Visual Studio claims the file is not found.
this is your error, I can't fix it for you

Explore More ContentExplore courses, solutions, and other research materials related to this topic.