I have this link and I want to insert an new element after the 180 price tag as shown here
My current code:
window.addEventListener('load', function () {
setTimeout(function () {
var itemPrice = document.getElementById("gsItemPrice").innerText.replace('¥', '').replace('.00', '') * 0.15;
console.log("$" + itemPrice)
var element = document.createElement('p');
element.style.fontSize = '20px';
element.innerHTML = "$" + itemPrice
function insertAfter(referenceNode, newNode) {
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
}
var findPart = document.getElementsByClassName('item-pri');
insertAfter(findPart, element);
}, 2000);
})
Error:
Uncaught TypeError: Cannot read properties of undefined (reading 'insertBefore')
Notes: The function timeout is set since the site uses a function to scrape the price of the item