You can create a hidden div element using CSS display property. Special character is appeared because of htmlentities api.
string htmlentities ( string $string [, int $flags = ENT_COMPAT | ENT_HTML401 [, string $encoding = ini_get("default_charset") [, bool $double_encode = true ]]] )
encoding:
An optional argument defining the encoding used when converting characters.
If omitted, the default value of the encoding varies depending on the PHP version in use. In PHP 5.6 and later, the default_charset configuration option is used as the default value. PHP 5.4 and 5.5 will use UTF-8 as the default. Earlier versions of PHP use ISO-8859-1.
Although this argument is technically optional, you are highly encouraged to specify the correct value for your code if you are using PHP 5.5 or earlier, or if your default_charset configuration option may be set incorrectly for the given input.
<?php
$str = '<div class="hidden-laugh" style="display:none">I am coming tomorrow<span class="_21wk" style="background-url:(\'/images/laugh.gif\')"> </span></div>';
echo $str;
echo '<a id="hidden-laugh" href="#">click</a>';
?>
Include the jquery library if it's not done before
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
You can display the content based on user click
<script type="text/javascript">
$(document).ready(function(e) {
$('#hidden-laugh').on('click', function(e) {
alert('here');
$(".hidden-laugh").removeAttr('style');
});
});
</script>