Skip to content

Latest commit

 

History

History
executable file
·
60 lines (56 loc) · 1.91 KB

w02d2.md

File metadata and controls

executable file
·
60 lines (56 loc) · 1.91 KB

w02d2 assessment

  1. How do we include jQuery into our html projects? What are the pros and cons of each option?
  2. What is the first thing to do in your javascript to start using jQuery?
  3. Given the following html use jQuery code solve the following questions
<body>
  <div>
    <ul> <!-- awesome list -->
      <li>first</li>
      <li>second</li>
      <li>third</li>
    </ul>
  </div>
  <ul> <!-- random list -->
    <li>ha</li>
    <li>he</li>
    <li>ho</li>
    <li>forth</li>
  </ul>
  <table>
    <thead>
      <tr>
        <th>First Name</th>
        <th>Last Name</th>
      </tr>
    </thead>
    <tbody>
      <tr> <!-- perfect start-->
        <td>Denis</td>
        <td>Cheung</td>
      </tr> <!-- perfect end-->
    </tbody>
  </table>
  <form id="name-form">
    <div>
      <label>First name</label>
      <input type="text" id="first-name">
    </div>
    <div>
      <label>Last name</label>
      <input type="text" id="last-name">
    </div>
    <button type="submit" id="submit-name"></button>
  </form>
</body>
  1. Select only the <li> within awesome list and set the color to red
  2. Select the second <li> in both awesome list and random list and set the background color to blue.
  3. Move the <li>forth</li> from random list into the end of awesome list.
  4. Delete random list.
  5. Target all <li> from awesome list and reverse their text. (eg. <li>first</li> will become <li>tsrif</li>)
  6. Retrieve the First name and Last name input and save them to a variable.
  7. With reference to the html structure from perfect start to perfect end, add an element with the same structure but with your name
  8. Append a new element to tbody with the user's inputs when the button is clicked
  9. What code can be put into the answer from above to clear input field?

Happy Coding!