Perhaps consider removing all inline CSS styles? You can achieve this by using
document.querySelector("#elementid").style = "";
Keep in mind that CSS applied through JavaScript is essentially inline styling, while those from external CSS files or <style> tags remain intact.
You might also want to assign a class to your element dynamically with JavaScript like so:
element.classList.add("class");
Then, when necessary, remove it using:
element.classList.remove("class");
Rather than continuously adding new inline styles with
document.querySelector("#elementid").style = "some styles";