WordPress adds superfluous </p> to qtip2 content. Cause Unexpected token ILLEGAL

I’m developing a wordpress plugin using qtip2.

Line breaking are not working.
When trying to create an in-memory div via a JS code following
HTML-encoding lost when attribute read from input field

Read More

The JS file should add the htmlDecode function code:

function htmlDecode(value){
  return JQuery('<div/>').html(value).text();
}

But unfortunately I’m getting “Unexpected token ILLEGAL” since WP adds a superfluous

 </p> 

and the post’s code breaks (from chrome DevTools):

return jQuery(("</p>
<div/>").html(value)).text();             } });

Please advice

Related posts

Leave a Reply

1 comment

  1. Solved by using the Javascript version of htmlDecode

    function htmlDecode(html){
        var a = document.createElement( "a" );
        a.innerHTML = html;
        return a.textContent; 
       };