- i am currently trying to add a class to a html element that is imported by php.The php file contains a a tag element
<a class="felt" href="felt.php">Felt Products</a>
i can not see the class being added, why is this? can js not effect imported elements?
<?php include 'headtaglinks.html'; ?>
<script>
var element = document.getElementsByClassName("felt");
element.classList.add("my-class");
</script>
- if i am being able to add a class to a php imported html element, will the added class stay when clicking on a href link? or will the class stay and be written unless i remove it?