前提
ここに質問の内容を詳しく書いてください。
appendChildが反映されません。何が原因でしょうか?
実現したいこと
main.js:7
Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'. at createSnow発生している問題・エラーメッセージ
エラーメッセージ
該当のソースコード
ソースコード
ヘディングのテスト
<html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Snow Foll</title> <link rel="stylesheet" href="/css/style.css"> </head> <body> <i class="snow">*</i> </div> <script src="/css/main.js"></script> </body> </html> ### css *{ margin: 0; padding: 0; } body{ background-image: url(/img/snow.jpg); width: 100%; height: 100vh; background-position: center; background-size: center; position: relative; } .snow { color: #fff; border-radius: 50%; position: absolute; animation: snowFall 5s linear forwards; transform-origin: left bottom; } @keyframes snowFall { 0%{ opacity: 1; transform: translateY(0vh) rotate(0); } 100%{ opacity: 0; transform: translateY(105vh) rotate(360deg); } }; ### Js function createSnow(){ const snow_icon = document.createElement("i"); snow_icon.classList.add("snow"); document.body.appendChild("snow_icon") }; createSnow(); ここに問題に対して試したことを記載してください。 ### 補足情報(FW/ツールのバージョンなど) ここにより詳細な情報を記載してください。
タイトルは要件を書きましょう。(質問は編集できます)
https://teratail.com/help/question-tips#questionTips31
回答1件
あなたの回答
tips
プレビュー