调查表单 - 制作一个调查表格

告诉我们发生了什么:
在此详细描述你的问题。

你目前的代码

<!-- file: index.html -->
<!DOCTYPE html>
<script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>
<html>
  <main>
    <h1 id="title">Survey Form</h1>
    <p id="description">This is a survey form.</p>
  </main>
  <form id="survey-form">
    <table id="survery-input-table" align="center">
      <tr>
        <td><label id="name-label" for="name">Name:</label></td>
         <td>
          <input placeholder="Enter the name" type="text" id="name"/>
        </td>
      </tr>
      <tr>
        <td><label id="email-label" for="email">Email:</label></td>
        <td><input placeholder="Enter the email"type="email" id="email"/>
        </td>
      </tr>
      <tr>
        <td><label id="number-label" for="number">Number:</label></td>
        <td><input placeholder="Enter the number" type="number" max="50" min="10" id="number"/>
        </td>
      </tr>
      <tr>
        <td>Dropdown list: </td>
        <td>
          <select id="dropdown">
            <option value="volvo">Volvo</option>
            <option value="saab">Saab</option>
            <option value="mercedes">Mercedes</option>
            <option value="audi">Audi</option>
          </select>
        </td>
      </tr>
      <tr>
        <td>Radio buttons: </td>
        <td>
          <input type="radio" id="male" name="gender" value="male">
          <label for="male">Male</label><br>
          
          <input type="radio" id="female" name="gender" value="female">
          <label for="female">Female</label><br>
          
          <input type="radio" id="other" name="gender" value="other">
          <label for="other">Other</label>
        </td>
      </tr>
      <tr>
        <td>Checkboxes: </td>
        <td>
          <input type="checkbox" id="male" name="gender" value="male">
          <label for="male">Male</label><br>
          
          <input type="checkbox" id="female" name="gender" value="female">
          <label for="female">Female</label><br>
          
          <input type="checkbox" id="other" name="gender" value="other">
          <label for="other">Other</label>
        </td>
      </tr>
      <tr>
        <td>Additional comments: </td>
        <td>
          <textarea></textarea>
        </td>
      </tr>
    </table>
    <br/>
    <button id="submit">Submit</button>
  </form>
  <div id="mocha"></div>
  
</html>
/* file: styles.css */
main{
  text-align: center;
}
#submit{
  margin-left: 48%;
  width: 5%;
  padding: 10px;
}

你的浏览器信息:

用户代理是: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36 Edg/115.0.1901.188

挑战: 调查表单 - 制作一个调查表格

挑战的链接:

您好,您的输入元素“#name”必须是必需的。这是通过以下方式实现的:

<input placeholder="Enter the name" type="text" id="name" required="true"/>

添加 required=“true”

输入“#email”也应该这样做

1 Like

是的,需要标注 必填。 required