Please write your question in detail here.
html is rewritten using getElementsByClassName of Javascript.

Error message

I don't know the reason why I didn't rewrite.

No change
Applicable source code

<meta charset ="utf-8">
<meta robot ="noindex">
<div class ="wrap">
<div class ="div">
<p class ="div">aa 株式会社</p>
<span id ="corp">corporation aa</span>
<div class ="class"></div>
<button type ="button"onclick ="clicker ();"></button>
function clicker () {
var change = document.getElementsByClassName ('div');
change [0] .innerHTML ="aa Corporation is" ;;

html, javascript
Tried Supplemental information (FW/tool version etc.)

Please provide more detailed information here.

  • Answer # 1

    If you copy and paste the code, it worked.
    It may depend on the environment, but
    <div class ="class"></div>
    Since there is a full-width space in this part, how about changing to a half-width space?

  • Answer # 2

    Aside from the quality of the source, I think it works as a proposition for the time being.
    If it doesn't work, you should provide the OS and browser type and version

Related articles