Advertisement
Guest User

Untitled

a guest
Jan 19th, 2020
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. async function main() {
  2. let rows = document.querySelectorAll('tr');
  3. for (let row of rows) {
  4. try {
  5. row.addEventListener('click', async function() {
  6. let inputElement = document.querySelector("#input");
  7. let inputData = inputElement.value;
  8. let url = "/" + row.cells[0].innerHTML;
  9. let response = await PUT(url, {newName: inputData});
  10. if(response.updateStatus == "OK"){
  11. row.cells[1].innerHTML = inputData;
  12. row.style.backgroundColor = "blue";
  13. }
  14.  
  15. })
  16. } catch (e) {
  17. console.log("Error: " + e.message);
  18. }
  19. }
  20. };
  21.  
  22. main();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement