<h1 class="MyClass">一</h1>
<script>
var hs =document.getElementsByTagName('h1');
alert(hs[0].className);
hs[0].className='XXXX';
</script>
This is this code. Why can't I set a new value for this tag? setAttribute() doesn't work either.
给我你的怀抱2017-05-19 10:47:09
Is there any interference from other h1 tags? I can use your code to test it and it’s fine