I want to show a message in element in page of wordpress(if parameter "message" in url have a value ).for this purpose i installed "Header and Footer Scripts" plugin.and write this code in "insert script to ":
<script>
function getUrlParameter(name) {
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
var results = regex.exec(location.search);
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
};
if(getUrlParameter('message'))
{
const para = document.createElement("p");
const node = document.createTextNode(getUrlParameter('message'));
para.appendChild(node);
const element = document.getElementsByClassName("entry-content");
element.appendChild(para);
}
</script>
but not working. and get error :
?message=ثبت انجام شد:291 Uncaught TypeError: element.appendChild is not a function at ?message=ثبت انجام شد:291
note:I used embed code plugin instead of "Header and Footer Scripts" plugin.My problem was solved.

getElementsByClassNamereturns a collection not a single element. So you need to access its content viaelement[0].appendChild(para);or whatever index you need