In Python Django I'm trying to launch a js function via button click, however I'm finding the following issues in the debug console:
On page load I get a ReferenceError jQuery is not defined
on https://localhost:8000/static/passkeys/js/bootstrap-toggle.min.js:8.
Afterwards, on button click I get another ReferenceError $ is not defined
. start: https://localhost:8000/passkeys/:86, onclick: https://localhost:8000/passkeys/:1.
From looking at other StackOverflow question it seemed that my problem was in the scripts/scripts order, which looked like so:
<script type="application/javascript" src="{% static 'passkeys/js/base64url.js'%}"></script>
<script type="application/javascript" src="{% static 'passkeys/js/helpers.js'%}"></script>
<script type="application/javascript">
Following a reply I added this and, just to make sure order wasn't an issue, I tried putting it between any of the other script lines:
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
Which gave me the classic "at least the error changed", and now I only get the following TypeError on click: $(...).modal is not a function
. start: https://localhost:8000/passkeys/:94, onclick: https://localhost:8000/passkeys/:1.
This is "my" modal:
<div class="modal " tabindex="-1" role="dialog" id="popUpModal" style=" top: 40px;">
<div class="modal-dialog" style="height: 80%;width: 80%;">
<div class="modal-content" >
<div class="modal-header">
<h4 class="modal-title" id="modal-title"></h4>
<button type="button" class="close" data-dismiss="modal" data-bs-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
</div>
<div class="modal-body" id="modal-body" >
</div>
<div class="modal-footer" id="modal-footer">
<button type="button" class="btn btn-default btn-secondary" id='btnModalClose' data-dismiss="modal" data-bs-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
Seems to me like it's progress at least, but from reading online this is again a script order issue and I've tried every combination so I'm not sure where to go from here?
Thanks!