将鼠标上的文字更改为[复制]

This question already has an answer here:

I need to change the text to the mouse hover over the buttons i try this code but doesn't work.

<script type="text/javascript">
  jQuery(function($){
    $(".cat-item-13").hover(function () {
     $('#text-digital-solution p').hide().html("<?php echo term_description('13','casestudies_category'); ?>").fadeIn('fast');

    });
 });
</script>

this is error: Uncaught SyntaxError: Unexpected token ILLEGAL

</div>

Here is a safer version. I assume you are failing due to quotes or newlines in the text from PHP

The encoding is taken from Pass a PHP string to a JavaScript variable (and escape newlines) - which, if it solves your issue should result in your question being marked as duplicate

$(function(){
  var desc = decodeURIComponent("<?php echo rawurlencode(term_description('13','casestudies_category')); ?>");
  $(".cat-item-13").hover(function () {
    $('#text-digital-solution p').hide().html(desc).fadeIn('fast');
  });
});

Try this and tell me if it works:

var test = '<?php echo term_description("13","casestudies_category"); ?>';
 $(".cat-item-13").hover(function () {
     $('#text-digital-solution p').html(test).fadeIn('fast');
    });

I am not sure to be honest if the PHP will be putout correctly, beacuse PHP commands are getting done on pageload.