erikTsomik
asked on
jquery issue
I ma trying to do a read more/read less functionality but does not seems to get it working right. It seems like I can not access the class directly because it surrounded by p tag
The content looks like this
<p>
hello here
<span class="feedback-moreconten t"> hello here 2</span>
</p>
<span class="feedback-showmore"> Show More</span>
And the JS is here
$(".feedback-morecontent") .hide();
$('span.feedback-showmore' ).on('clic k', function (e) {
$(this).text($(this).text( ) == 'Show More' ? 'Show Less' : 'Show More');
$(this).prev("p").prev(".f eedback-mo recontent" ).slideTog gle("slow" );
e.preventDefault();
});
The content looks like this
<p>
hello here
<span class="feedback-moreconten
</p>
<span class="feedback-showmore">
And the JS is here
$(".feedback-morecontent")
$('span.feedback-showmore'
$(this).text($(this).text(
$(this).prev("p").prev(".f
e.preventDefault();
});
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
<p>hello here </p>
<p class="feedback-moreconten
<span class="feedback-showmore">
Then for jquery:
$(document).ready(function
$(".feedback-morecontent")
$('span.feedback-showmore'
$(this).text($(this).text(
$(this).prev("p").slideTog
e.preventDefault();
});
});