I have tried a lot of ways but they don't seem to apply to my scenario. I want the anchor element to move 20px along the x axis. HTML:
<!-- When this is clicked moveElement() is initiated to translateX by 20px -->
<a href="#" id="aButton" class="getStarted" onclick="moveElement()">Get started</a>
Javascript:
function moveElement() {
let btn = document.getElementById("aButton");
btn.style.translateX = "20px";
// I also tried transform = 'translateX("20px")' but it did not work.
}
translateX is not a valid CSS property. Perhaps you mean:
btn.style.transform = "translateX(20px);";