HTML string construction found, please use DOM element construction instead

0

The Wordpress VIP Scanner gives me this error in JS, does anyone know about this?

$( '.canned_response .button-box').append('<a href="#" id="set-send" data-status="' + status + '" class="backend-button">Set Status to "' + status + '" and Send</a>');
    
asked by Santiago D'Antuoni 14.11.2016 в 21:18
source

1 answer

0

It is telling you to use an HTML object, not a text. Create an "a" element with a document.createElement("a") , indicate the parameters, and enter it in append instead of the text " <a href... ".
Something similar to this:

var elemento = document.createElement("a");
elemento.href="#";
elemento.id="set-send";
elemento.data-status=status;
elemento.class="backend-button";
elemento.innerHTML="Set Status to " + status + " and Send";
$( '.canned_response .button-box').append(elemento);
    
answered by 14.11.2016 в 21:30