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')
})
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can do this:
In your current code
thisrefers to whatever you’re running this in, probably adocument.readyfunction (sothis=document). In this version, you’re looping through.bannerelements, andthisrefers 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.idraw DOM style is shorter and faster 🙂