I have an list with each item having a different ID
. So for single item i have written the HTML part.
The structure is something like
<div id='33496'>
<div class='event_content'>.....
<div>......
</div>
.....
</div>
<div class='event_content1'>
......
</div>
<div class='job_inn'>.....</div>
<div><a id="show_more">text</a>
</div>
<div id='33495'>
<div class='event_content'>.....
<div>......
</div>
.....
</div>
<div class='event_content1'>
......
</div>
<div class='job_inn'>.....</div>
<div><a id="show_more">text</a>
</div>
So i want here is if i will click any of the div either event_content1
or event_content
or job_inn
the text of show_more
should change how can i do that ??
Here is the code i tried & got the solution....
$(".event_content1,.job_inn,.event_title").unbind('click').click(function(){
var divid = $(this).attr('data-id');
var show_more = "#show_more" + divid;
var show_less = "#show_less" + divid;
if($(show_more).is( ':visible' )){
$(this).parent().find('.show_more_link').text('show more');
$(show_more).toggle('slow');
$(show_less).toggle('slow');
} else {
$(this).parent().find('.show_more_link').text('show less');
$(show_more).toggle('slow');
$(show_less).toggle('slow');
}
});