Link click event stopped working
Hey,
This problem quite honestly pisses me off, so I hope someone can help me. I had the following, which worked perfectly:
- <a href="#" class="page">1</a> <a href="#" class="page">2</a> <a href="#" class="page">3</a>
and the jQuery:
- $('.page').click(function() {
- console.log("you clicked");
- });
But now when I add the links within a div, it stops working.
- <div id="newsPages" class="pageNumbers">
- <a href="#" class="page">1</a> <a href="#" class="page">2</a> <a href="#" class="page">3</a>
- </div>
This frustrates me so much, because shouldn't it still find the links? I tried the below just to make my selection more precise (even though I'm pretty sure it doesn't matter if there are no other links of that class on the page):
- $('#newsPages .page').click(function() {
- console.log("you clicked");
- });
- $('.pageNumbers .page').click(function() {
- console.log("you clicked");
- });
None of it works. What on Earth am I doing wrong?
Thanks.