$.ajax({
url: '/blog/tag/' + brandName,
type: 'GET',
dataType: 'html'
}).done(function(data) {
// find “color” swatches
var blogPage = $('.page', data).filter(function() {
//console.log( $(this).find('.form-label').text().trim() );
//console.log(Boolean( $(this).find('.form-label').text().trim().indexOf('Colour') > -1 ) );
return $(this).find('.form-label').text().trim().indexOf('Colour') > -1 ;
})
.find('.form-option');
// // Append swatches;console.log(thisSwatches);
if (thisSwatches.length > 0) {
thisSwatches.wrapAll('<div class="cnz-swatch"></div>').parent().appendTo(thistarget);
var colorTitle = thisSwatches.first().addClass('active').find('.form-option-variant').attr('title')
thistarget.find('.card-sub-title').html(colorTitle);
thisSwatches.each(function(index, ele){
$(ele).click(function(){
var colorTitle = $(this).find('.form-option-variant').attr('title');
$(this).addClass('active').siblings().removeClass('active');
thistarget.find('.card-sub-title').html(colorTitle);
});
});
} // end if
}); // end ajax done