Reputation: 1273
For a js click function to View and Hide some comments, i use this unicode
▼
and ▲
(Arrow up and arrow down)
$('.toggle-<?php echo $comment_id; ?>').click(function(){
$(this).text($(this).text() == 'Hide replies ▲' ? 'View replies ▼' : 'Hide replies ▲');
But it shows me literally the code instead of the arrow.
So how i need to use the code in the script above?
Upvotes: 0
Views: 390
Reputation: 28196
The syntax &#<num>;
is html, therefore it needs to be entered as such, using $(...).html('▼ ...')
instead of $(...).text('▼ ...')
.
The following should work:
$(this).html($(this).text().substr(0,4) == 'Hide' ? 'View replies ▼' : 'Hide replies ▲');
Upvotes: 2