Nice JS function :-)

const body = document.querySelector('body');
const linksOnFrontpage = document.querySelectorAll('.box-with-border-bottom');

    for (const link of linksOnFrontpage) {
    	link.addEventListener('click', () => {
    		console.log(link.id);
    		const clickLink = document.createElement('a');
    		clickLink.id = 'javascriptClick-' + link.id;
    		clickLink.href = 'https://example.com/products/#' + link.id;
    		body.appendChild(clickLink);
    		document.getElementById('javascriptClick-' + link.id).click();
    	})
    }

Leave a Reply

Your email address will not be published. Required fields are marked *