I'm using colorbox, i just get undefined as my get values?
$('.banner').colorbox({
opacity: 0.4,
href: 'dialogs/ban_add_edit.php?banner_to_edit='+$(this).attr('id')+'&typeofbanner='+$(this).attr('rel')
})
I'm using colorbox, i just get undefined as my get values?
$('.banner').colorbox({
opacity: 0.4,
href: 'dialogs/ban_add_edit.php?banner_to_edit='+$(this).attr('id')+'&typeofbanner='+$(this).attr('rel')
})
You can do this:
$('.banner').each(function() {
$(this).colorbox({
opacity: 0.4,
href: 'dialogs/ban_add_edit.php?banner_to_edit='+this.id+'&typeofbanner='+$(this).attr('rel')
});
});
In your current code this refers to whatever you're running this in, probably a document.ready function (so this = document). In this version, you're looping through .banner elements, and this refers to the element you're on as you loop.
One more change is this.id, I often do this to, but no need for $(this).attr('id') unless you need to handle it being chained later...this.id raw DOM style is shorter and faster :)