Created
December 19, 2016 23:11
-
-
Save Philocoder93/48c47df1203fd20bdb9065c8ed266d4e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // this code is my attempt at answer to question 1, I am not sure why it is not working | |
| var apple = document.getElementsByClassName('current'); | |
| for ( i=0; i<apple.length; i++) { | |
| document.getElementsByClassName('current').className = 'finished'; | |
| } | |
| document.getElementById('next').className = 'current'; | |
| document.getElementById('next').removeAttribute('id'); | |
| document.getElementsByTagName('li')[3].setAttribute('id', 'next'); | |
| var addCool = function() { | |
| var listNum = document.getElementsByTagName('li').length; | |
| for (i=0; i < listNum; i++) { | |
| document.getElementsByTagName('li')[i].setAttribute('class', 'cool'); | |
| } | |
| }; | |
| document.getElementById('chill').addEventListener('click',addCool); | |
| var addLi = function () { | |
| var newListItem = document.createElement('li'); | |
| newListItem.textContent = 'Javascript'; | |
| document.getElementsByTagName('li')[4].appendChild(newListItem); | |
| } | |
| document.getElementsByTagName('li')[0].addEventListener('click',addLi); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment