Get Element with jQuery .on()
- by Gabriel Ryan Nahmias
If I'm using jQuery's .on() function like this (there's more to it but this is the main problem area extracted):
$(document).on("click", $("#contcont a, #leftnav li a, #leftnav li ul a, #mainarea-home a").not(".secitem-mid a") , function clicker(event, sData) {
var $this = $(this);
sHREF = $this.attr("href");
alert(sHREF);
} );
I'm getting undefined so what would be the best way to actually get the element that's being clicked? I need .on() so that it always occurs, obviously, instead of having to attach it to all the elements every time new data is loaded (this is through Yahoo! stores so it's a necessity to do it this way). Thanks.