teofarov13

Untitled

Oct 21st, 2023
830
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solution() {
  2.   const employeeInput = document.getElementById('employee');
  3.   const categoryInput = document.getElementById('category');
  4.   const urgencyInput = document.getElementById('urgency');
  5.   const teamInput = document.getElementById('team');
  6.   const descriptionInput = document.getElementById('description');
  7.   const addButton = document.getElementById('add-btn');
  8.   const editButton = document.getElementById('edit-btn');
  9.   const continueButton = document.getElementById('continue-btn');
  10.   const previewList = document.querySelector('.preview-list');
  11.  
  12.   addButton.addEventListener('click', () => {
  13.     const employee = employeeInput.value.trim();
  14.     const category = categoryInput.value.trim();
  15.     const urgency = urgencyInput.value.trim();
  16.     const team = teamInput.value.trim();
  17.     const description = descriptionInput.value.trim();
  18.  
  19.     if (employee === '' || category === '' || urgency === '' || team === '' || description === '') {
  20.       return;
  21.     }
  22.  
  23.     const listItem = document.createElement('li');
  24.     listItem.innerHTML = `
  25.       <span>${employee}</span>
  26.       <span>${category}</span>
  27.       <span>${urgency}</span>
  28.       <span>${team}</span>
  29.       <span>${description}</span>
  30.       <button class="edit-btn">Edit</button>
  31.       <button class="continue-btn">Continue</button>
  32.     `;
  33.     previewList.appendChild(listItem);
  34.  
  35.     employeeInput.value = '';
  36.     categoryInput.value = '';
  37.     urgencyInput.value = '';
  38.     teamInput.value = '';
  39.     descriptionInput.value = '';
  40.     addButton.disabled = true;
  41.     editButton.disabled = false;
  42.     continueButton.disabled = false;
  43.   });
  44. }
  45.  
Advertisement
Add Comment
Please, Sign In to add comment