I have this function that works fine, but it looks really ugly and repetitive...
Basically I have a featured profile and underneath I have 4 smaller thumbnails, on click I want to populate the large profile. The code works fine it just doesn't look too good...
$('ul.teamProfiles li').click(function () {
var $name = $(this).find('h4.name').html();
var $picture = $(this).find('img').data('bigimg');
var $biography = $(this).find('.biographyParas').html();
var $jobTitle = $(this).find('p.jobTitle').html();
var $telephone = $(this).find('p.telephone').html();
var $linkedin = $(this).find('a.linkedinLink').attr('href');
var $twitter = $(this).find('a.twitterLink').attr('href');
var $mailto = $(this).find('a.mailtoLink').attr('href');
$('.profileDetail .largeImg').attr('src', $picture);
$('.profileDetail h3.name').html($name);
$('.profileDetail h4.jobtitle').html($jobTitle);
$('.profileDetail .biographyContainer').html($biography);
$('.profileDetail span.telephone').html($telephone);
$('.profileDetail a.linkedin').attr('href', $linkedin);
$('.profileDetail a.twitter').attr('href', $twitter);
$('.profileDetail a.email').attr('href', $mailto);
});
a.linkedinLink
etc. selectors. A rule in CSS is to use specificity so removing the target element type would be the first thing I do; i.e..linkedin-link
\$\endgroup\$