Reputation: 14803
I am trying to do two things:
editlink
make a popup and not go to their hrefDoing just #2 is fine:
$(document).ready(function(){
// $(body).append("<div>Hello world</div>");
$("a.editlink").click(function(event){
alert("Javascript-endabled users should see this");
event.preventDefault();
});
});
But if I uncomment the code for #1 like below,
$(document).ready(function(){
$(body).append("<div>Hello world</div>");
$("a.editlink").click(function(event){
alert("Javascript-endabled users should see this");
event.preventDefault();
});
});
the div appears as expected, but clicking editlink
links no longer gives me a popup and navigates to the link's href.
What's going on?
Upvotes: 0
Views: 86
Reputation: 827276
You are missing the quotes for your body tag selector:
$('body').append("<div>Hello world</div>");
Upvotes: 1
Reputation: 281425
Did you mean:
$("body")
rather than:
$(body)
?
Can I recommend that you use Firebug to get decent error reporting? You'd have found this very quickly with Firebug.
Upvotes: 1