I am a starter on jquery. and I encountered this problem today. really hope someone can help.
$('#lecture').on('click', function() {
$("#screen").load("lecture_page.html");
});
error : course_page.js:7 Uncaught TypeError: $(...).load is not a function
however,
$("#screen").load("lecture_page.html");
this line works by itself.
I already spent couple hours on this by searching through stackoverflow. I tried couple approaches such as: checked my version is not "slim", tried .on("load") instead of .load()...
forgot to mention:
$('#lecture').on('click', function() {
$("#screen").html("lecture_page.html");
});
if I use the .html() method instead of .load(), it will function correctly and display the text "lecture_page.html" at the correct position.
solved. The reason ends up to be the global sidebar that I am using do have a slim version included in it. Thank you guys for the fast responses. This is my first question on stackoverflow. The experience was very good!
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js">
//alert('course page js connected');
$(function() {
$("#sidebar").load("sidebar.html");
});
$('#lecture').on('click', function() {
$("#screen").load("lecture_page.html");
});
//error : course_page.js:7 Uncaught TypeError: $(...).load is not a function
//$("#screen").load("lecture_page.html"); //this line works fine, however the above "load" cannot be recognized
//-------------------------------------------------------------------
//below is everything I have tried
// $("#lecture").click(function(e){
// //e.preventDefault();
// console.log("clicked");
// $("#screen").load("lecture_page.html");
// });
//$("#screen").load("lecture_page.html");
// $(document).on('click','#lecture',function(e){
// //e.preventDefault();
// console.log("clicked");
// $("#screen").load("lecture_page.html");
// });
</script>