I'm creating a Toggle function I've done the bigger part (I hope). But now I'm facing two problem :
• I can Show and Hide my resume but I can't do it again (more than once in each direction).
• I Dont get how to apply this to a specific resume and not to every one; shall I use .each() ? I'm a bit lost on it I admit.
This is what I've manage to do for now :
HTML
<div class="resume">Lorem Ipsum .... </div>
jQuery
$(document).ready(function(){
if($('.resume').text().length > 100)
{
complet = $('.resume').text();
complet += '<span class="showLess"> Cacher</span>';
html = $('.resume').text().slice(0,100);
html += '<span class="showMore">...</span>';
$('.resume').html(html);
}
$('.showMore').on('click',function(){
$('.resume').html(complet);
showLess();
});
function showLess(){
$('.showLess').on('click', function() {
$('.resume').html(html);
});
}
});
And here is the jsFiddle