I am trying to use jQuery & AJAX to replace the content of a div with content of a thumbnail div. Right now I have a featured section which has specific styling for its h2, h3 and p tags, as well as its video.
The thumbnails have the same markup as far as h2, h3, p tags and a video but each with their own specific css styling.
What I'm looking to do is on click of one of the thumbnails, it replaces the feature section with the information of the thumbnail and then puts the featured section down within the thumbnails.
I have it somewhat started but I can't seem to remove and add classes to the specific thumbnail without actually changing the css of the thumbnail below either.
Any help would be greatly appreciated.
I have created a jsfiddle with my current set up and what I have so far.
http://jsfiddle.net/drewbietron/YstAQ/
$(document).ready(function(){
$("#one.promo-item").click(function(e){
e.preventDefault();
var content = $(this).html();
$('.video-container-featured').replaceWith('<div class="video-container-promo" id="one">' +content+ '</div>'),
$('#one.video-container-promo').addClass('.video-container-featured');
});
});
Thank you!
jqueryandajax) do not need to be in your title because the tags on them will set the context anyway. Great question otherwise.idmust be unique in the document: w3.org/TR/html401/struct/global.html#h-7.5.2 Doesn't matter how you intend to use them.