Link click event stopped working

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:

  1. <a href="#" class="page">1</a> <a href="#" class="page">2</a> <a href="#" class="page">3</a>

and the jQuery:

  1. $('.page').click(function() {
  2.       console.log("you clicked");
  3. });

But now when I add the links within a div, it stops working.

  1. <div id="newsPages" class="pageNumbers">
  2.       <a href="#" class="page">1</a> <a href="#" class="page">2</a> <a href="#" class="page">3</a>
  3. </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):

  1. $('#newsPages .page').click(function() {
  2.        console.log("you clicked");
  3. });

  1. $('.pageNumbers .page').click(function() {
  2.        console.log("you clicked");
  3. });

None of it works. What on Earth am I doing wrong?

Thanks.