B
B
buttlessrider2020-05-14 02:00:13
JavaScript
buttlessrider, 2020-05-14 02:00:13

Why is the entire page loading?

Hello everyone, here is the code:

<script>
$(function() {
$('#listface').on('click', 'a', function(event) {
event.preventDefault();
var url = $(this).attr('href');
$("#chater").load( url + '#sections' );
});
});
</script>


But the insertion takes place of the entire content of the page I am accessing, and not of the block with id sections... :( Help me solve the issue plz!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arseny, 2020-05-14
@buttlessrider

$("#chater").load( url + ' #sections' );
According to the documentation , you skipped a space by forming a link with an anchor instead of referring to an element with an ID.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question