I know jQuery pretty well. This one is driving me nuts because it’s SO simple.
I have this in the <head>:
<script>
$(document).ready(function() {
$(".delete_social").click(function() {
return false;
});
});
</script>
and in the body I have a series of links:
<a class="delete_social" href="save_page.php?delete_social=true">Delete</a>
But EVERY time I click those links, it takes me right ot that PHP page. Why isn’t jQuery intercepting the click? Any theories?
PS I’ve tried adding a simple alert() event to the click() function, with no change, and I’ve tried using “a.delete_social” in the jQuery $() call. Neither worked.
If these links are loaded in dynamically, you’ll need to use
$.live()to control them:$.live()causes dynamically-added elements to adhere to previously-declared rules.