I am using this script:
if (window.matchMedia("(max-width: 1440px)").matches) {
var a = document.createElement("a");
var ulist = document.getElementById("areas");
var newItem = document.createElement("p");
a.textContent = "PRACTICE";
a.setAttribute('href', "practice");
newItem.appendChild(a);
ulist.prepend(newItem);
}
It works fine but in iphone, which displays this error:
TypeError: undefined is not a function (evaluating ‘ulist.prepend(newItem)’)
Is something wrong with the script?