$(function() { $('span').click(function() { $(this).parents('li').removeClass('on'); }) $('small').click(function() { $(this).parents('li').addClass('on'); }) var height = 38; $('ul li').each(function() { //alert(parseInt($(this).find('p').height()) if(parseInt($(this).find('p').height()) < height) { $(this).addClass('hide') } }) })