Last active
August 29, 2015 14:23
-
-
Save awongh/50a150ecedaccf177544 to your computer and use it in GitHub Desktop.
jquery translation exercises
This file contains 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
//If these DOM elements don't exist yet, just create them!!!!! | |
// 1 | |
var h3 = document.querySelector('h3'); | |
// 2 | |
var h3 = document.querySelector('h3'); | |
h3.innerText = "Monkey Cheese"; | |
// 3 | |
var h3 = document.querySelector('h3'); | |
h3.classList.add('fusia'); | |
// 4 | |
var button = document.querySelector('button'); | |
button.addEventListener('click', function() { | |
console.log('hello!'); | |
}); | |
// 5 | |
var li = document.createElement('li'); | |
var body = document.querySelector('body') | |
li.innerText = 'Cheeseburgers'; | |
li.classList.add('huge'); | |
body.appendChild(li); | |
// 6 | |
var button = document.querySelector('button'); | |
var myFunc = function() { | |
console.log("WEEEE"); | |
this.innerText = 'I WAS HOVERED OVER'; | |
} | |
button.addEventListener('mouseover', myFunc); | |
// hover over button | |
button.removeEventListener('mouseover', myFunc); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment