Here I'm trying to use bootstrap-jquery datetimepicker for my form. but unfortunately I'm getting an error that datetimepicker undefined function. here is my code `
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.7.1/css/bootstrap-datepicker.min.css" rel="stylesheet"/>
<script src="http://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.0/js/bootstrap-datepicker.js"></script>
<script type="text/javascript">
$('#date').datetimepicker({
todayHighlight: true,
format: 'dd/mm/yyyy',
startDate: new Date()
});
</script>```
Uncaught TypeError: $(...).datetimepicker is not a function
Any help that would be appreciated. Thanks in advance
The plugin is called "datepicker", so you're loading the wrong plugin. Which is why you're getting the Uncaught TypeError: $(...).datetimepicker is not a function error because "datetimepicker" doesn't exist.
So download it from github (there's a link to the repo in the upper-right corner for github) and include it normally. Usually composer is for php packages, not javascript. npm is for javascript.
That said, I simply went to packagist.org and searched for "bootstrap-datetimepicker" and easily found it, so you can use composer to install it. Why it's on packagist, I don't know.
You'll need to figure it out as I'm not using that plugin. But I answered your question on why you're getting the error.
So load the right plugin. Do you need step by step instructions, or can you read the docs? I've linked to them, and even said it was on packagist (you could have easily searched there too) so you can just go there and search for it and install it via composer. What more do you want? Have you actually tried anything that I said?