LoginSignup
0
0

More than 3 years have passed since last update.

ボタンをクリックして要素を非表示から表示に切り替える

Last updated at Posted at 2021-01-06
<!DOCTYPE html>
<html lang="ja">
<head>
    <meta charset="UTF-8" name="Content-Style-Type" content="text/css">
    <title>Document</title>
</head>
<body>
    <h1 style="display: none;">サンプルタイトル</h1>
    <h2 style="display: none;">サンプルタイトル</h2>
    <button>ボタン</button>

    <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
    <script>
        $('button').click(function() {
            $('h1').toggle();
            $('h2').toggle();
        })
    </script>
</body>
</html>
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0