Access a community of over 900,000 Shopify Merchants and Partners and engage in meaningful conversations with your peers.
Hello,
I'm trying to change the text content of the default_pagination Previous and Next buttons with javascript, but I can't even target the elements.
First I tried this:
const prevBtn = document.querySelector('#pagination .prev a');
const nextBtn = document.querySelector('#pagination .next a');
prevBtn.textContent = '<';
nextBtn.textContent = '>';
And also this:
window.addEventListener('DOMContentLoaded', () => {
const prevBtn = document.querySelector('#pagination .prev a');
const nextBtn = document.querySelector('#pagination .next a');
prevBtn.textContent = '<';
nextBtn.textContent = '>';
});
The content isn't changing and if I type prevBtn or nextBtn in the chrome dev console I got this error:
Uncaught ReferenceError: prevBtn is not defined
at <anonymous>:1:1
If I querySelect the elements in the chrome dev console, it works.
Thanks,
Solved! Go to the solution
This is an accepted solution.
Dear @dannyelo
Add this question at "Shopify design" section for better solution
This is an accepted solution.
Dear @dannyelo
Add this question at "Shopify design" section for better solution
Hey!
Yes that’s what I did already.
Thanks for reply.