I want to expand content to its height (not fixed). I've done this by my self and also I've found its solution on http://jsfiddle.net/w6eqk/1/, and its working fine as expected. But it messed up when I duplicate it. i want to show toggle expand function more then 1 time. It is working fine on single only but not on multiple. here is the demo link for multi content. http://jsfiddle.net/w6eqk/129/
$(document).ready(function() {
$('div.view').each(function(){
$(this).removeClass('view');
var innerh= $(this).height();
$(this).next().toggle(function(){
$(this).prev().animate({height: innerh},200);
},function(){
$(this).prev().animate({height:40},200);
});
$(this).addClass('view');
});
});
try this instead, the toggle method fires each time the element is clicked