bootstrap-4: Cannot read property '_options' of undefined
Hello, For some reason, when there is one simple javascript error (not related with tempusdominus) this script generates one error when clicking in the input field to open the picker (No Icon demo used).
Error : tempusdominus-bootstrap-4.js:2762 Uncaught TypeError: Cannot read property ‘_options’ of undefined at HTMLInputElement.<anonymous> (tempusdominus-bootstrap-4.js:2762) at HTMLDocument.dispatch (jquery.js:5206) at HTMLDocument.elemData.handle (jquery.js:5014) at Object.trigger (jquery.js:8201) at Object.simulate (jquery.js:8260) at HTMLDocument.handler (jquery.js:8319)
HTML :
No Icon (input field only):
<div class="container">
<div class="row">
<div class="col-sm-6">
<input type="text" class="form-control datetimepicker-input" id="datetimepicker5" data-toggle="datetimepicker" data-target="#datetimepicker5"/>
</div>
</div>
</div>
Javascript :
console.log(notAvailableVar);
$(function () {
$('#datetimepicker5').datetimepicker();
});
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 10
- Comments: 21
Commits related to this issue
- fix #193 from comment in the discussion just made a fork with the patch from https://github.com/tempusdominus/bootstrap-4/issues/193#issuecomment-465649868 so i can use this repo in npm. — committed to altimore/bootstrap-4 by altimore 5 years ago
- Added fix for Issue #193 — committed to ouija/tempusdominus-bootstrap-4 by ouija 5 years ago
try this
then add this code(JS)
$(.datepickers).datetimepicker({});
hope can help 😃
Edited the library as suggested by @coltonf93 as shown below to stop getting _options when input was focused without icon. Hopefully, this fix will be included in the main branch soon.
Still haven’t found a fix for ‘isSame’ undefined errors when the date is deleted from the input box and datetimepicker is focused again.
having the same issue here, did you find a solution?
Had an issue similar to this, where it kept saying cannot read property of undefined. Turned out I had accidentally included the library 2 times within that page (one in _Layout.html and one in my actual page.)