I have the following lines of code:
$("a.quickview").fancybox({
ajax : {
type : "POST",
data : 'itemID=' + $(this).attr("name")
}
});
Which is binding on:
<a name="614" class="quickview" href="/URL/index.cfm">quick view</a>
I want data to post as itemID=614, but $(this).attr("name") is coming back as undefined? What am I doing wrong?
Thanks
If you are using Fancybox 2.0, you can do this:
$("a.quickview").fancybox({
ajax : {
type : "POST",
data : 'itemID=' + $(this.element).attr("name")
}
});]
Source: Code snippet from fancyBox Github issue (this works) =>
$(".fancybox").fancybox({
beforeShow : function() {
this.title = $(this.element).attr('fancybox-title');
}
});