Jquery Using Waypoint Get Id Of Element
i'am using jquery waypoints (http://imakewebthings.com/jquery-waypoints/#docs) to check if an element is the view of the browser, here the html:
this refers to a waypoints internal object. If you console.log it though, you easily find how to select that element with jquery.
handler: function (direction){
varDOMElement = $(this.element);
console.log($(this.element).attr('data-id');
}
Solution 2:
You are missing parenthesis: )
at the end of console.log otherwise it would work.
$('.container').waypoint(function() {
console.log("id of element: " + $(this).attr('id'));
});
If you are confusing, you can use like this too:
$('.container').waypoint(function() {
var $this = $('.container');
console.log("id of element: " + $this.attr('id'));
});
Post a Comment for "Jquery Using Waypoint Get Id Of Element"