Quote OP:
Am I doing something wrong?
As others have noted, your code should work if you add missing closing brackets. });
You also did not specify which version of jQuery, however, using the latest version 1.7, you should use 1 instead and instead .on() delegate()prop()attr()
$("body").on("click", "a", function (event) {
var link_name = $(this).prop('name');
alert(link_name);
});
- Starting with jQuery 1.7, .delegate () has been replaced with the .on () method.
source
share