vancouver style references generator

🧩 Syntax:
<!DOCTYPE html>
<html>
<head>
  <title>Vancouver Style Reference Generator</title>
  <style>
    body {
      font-family: Arial, sans-serif;
      background-color: #f5f5f5;
    }

    h1 {
      text-align: center;
      margin-top: 30px;
    }

    form {
      max-width: 500px;
      margin: 0 auto;
      background-color: #fff;
      border-radius: 5px;
      padding: 20px;
      box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.2);
    }

    label {
      display: block;
      font-weight: bold;
      margin-bottom: 5px;
    }

    input[type="text"] {
      width: 100%;
      padding: 8px;
      border-radius: 3px;
      border: 1px solid #ccc;
      margin-bottom: 10px;
      box-sizing: border-box;
    }

    button[type="submit"], button[type="button"] {
      background-color: #4CAF50;
      color: #fff;
      border: none;
      border-radius: 3px;
      padding: 8px 16px;
      font-size: 16px;
      cursor: pointer;
      margin-bottom: 10px;
    }

    button[type="submit"]:hover, button[type="button"]:hover {
      background-color: #3e8e41;
    }

    #output {
      max-width: 500px;
      margin: 30px auto;
      background-color: #fff;
      border-radius: 5px;
      padding: 20px;
      box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.2);
    }

    .copy-button {
      margin-bottom: 10px;
      display: block;
    }
  </style>
</head>
<body>
  <h1>Vancouver Style Reference Generator</h1>

  <form id="reference-form">
    <div>
      <label for="author-name">Author Name:</label>
      <input type="text" id="author-name" required>
    </div>
    <div>
      <label for="title-name">Title:</label>
      <input type="text" id="title-name" required>
    </div>
    <div>
      <label for="journal-name">Journal Name:</label>
      <input type="text" id="journal-name" required>
    </div>
    <div>
      <label for="volume">Volume:</label>
      <input type="text" id="volume" required>
    </div>
    <div>
      <label for="edition">Edition:</label>
      <input type="text" id="edition" required>
    </div>
    <div>
      <label for="page-no">Page Number:</label>
      <input type="text" id="page-no" required>
    </div>
    <div>
      <label for="year">Year:</label>
      <input type="text" id="year" required>
    </div>

    <button type="submit">Generate Reference</button>
  </form>

  <div id="output"></div>

  <script>
    const form = document.querySelector('#reference-form');
    const copyButton = document.querySelector('.copy-button');

    form.addEventListener('submit', function(event) {
      event.preventDefault();

      const authorName = document.querySelector('#author-name').value;
      const title = document.querySelector('#title-name').value;
      const journalName = document.querySelector('#journal-name').value;
      const volume = document.querySelector('#volume').value;
      const edition = document.querySelector('#edition').value;
      const pageNo = document.querySelector('#page-no').value;
      const year = document.querySelector('#year').value;

      const output = document.querySelector('#output');
      const reference = `${authorName}. ${title}. ${journalName}. ${year};${volume}(${edition}):${pageNo}.`;

      output.innerHTML = `<p>${reference}</p>`;
    });

    copyButton.addEventListener('click', function() {
      const output = document.querySelector('#output p');
      if (!output) return;

      const range = document.createRange();
      range.selectNode(output);
      window.getSelection().removeAllRanges();
      window.getSelection().addRange(range);
      document.execCommand('copy');
      alert('Reference copied to clipboard!');
      window.getSelection().removeAllRanges();
    });
  </script>
</body>
</html>
only take first letter of first name of authors and the copy button is not visible