Skip to content

Instantly share code, notes, and snippets.

@AbhinavMadahar
Forked from Nikolay-Pomytkin/liveChange.js
Last active October 19, 2016 23:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AbhinavMadahar/50ad57186bca297b59fa3cb4cfdf3735 to your computer and use it in GitHub Desktop.
Save AbhinavMadahar/50ad57186bca297b59fa3cb4cfdf3735 to your computer and use it in GitHub Desktop.
// Array with all gpas
const gradeNodes = [document.getElementById('grade1')];
const grades = [];
// Create click event listeners for each gpa
gradeNodes.forEach((gradeNode, i) => {
gradeNode.addEventListener("click", () => {
gradeNodes[i].innerHTML = `<input value="${grades[i]}" id="${i}" />`
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment