Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- async function main() {
- let rows = document.querySelectorAll('tr');
- for (let row of rows) {
- try {
- row.addEventListener('click', async function() {
- let inputElement = document.querySelector("#input");
- let inputData = inputElement.value;
- let url = "/" + row.cells[0].innerHTML;
- let response = await PUT(url, {newName: inputData});
- if(response.updateStatus == "OK"){
- row.cells[1].innerHTML = inputData;
- row.style.backgroundColor = "blue";
- }
- })
- } catch (e) {
- console.log("Error: " + e.message);
- }
- }
- };
- main();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement