0
0

More than 3 years have passed since last update.

JavaScriptでボタンの表示を変更

Posted at
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">

  <style>
    #text-button {
      display:block;
      cursor:pointer;
      width: 160px;
      text-align:center;
      border: 1px solid #232323;
    }
  </style>
  <title>Document</title>
</head>
<body>
  <div id="text-button"><p id="text">あなたのことが好きです。結婚してください。</p></div>
  <script>
    document.getElementById("text-button").onclick = function() {
      document.getElementById("text").innerHTML = "すみません。私はあんまり。";
    };
  </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