I'm creating a lightbox for a website i'm creating, no i don't want to use one already made, i want to make my own.
when the user clicks on a somewhere on the website, i have jquery grab that 's title attribute, and stick it into an image src, and then inject that image tag into .overlay_content
everything works except it wont grab the title, the variable doesn't work and i don't know what i did wrong, it's inserting grabbed-img into the src for the image, not the title of the span.overlay_img
$(document).ready(function() {
$('.overlay_img').click(function (){
var docHeight = $(document).height();
var grabbed_img = $(this).attr('title');
$(".overlay_bg").height(docHeight).fadeIn(300, function(){
$(".overlay_content").html("<img src='grabbed_img'>").fadeIn(300);
});
});
});