Last active
November 22, 2017 10:39
-
-
Save flexbox/12ce1193465b9df61eccfe19273b2841 to your computer and use it in GitHub Desktop.
How I’m (Not) Using jQuery – http://youmightnotneedjquery.com/
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
//https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API | |
fetch('/data.json') | |
.then(res => res.json()) | |
.then(res => { | |
// res is my data | |
}); |
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
$("#listOfProducts").on("click", ".productThumb", function() { | |
// STUFF | |
}); | |
document.addEventListener('click', function(e) { | |
if(e.target.className !== 'editLink') return; | |
e.preventDefault(); | |
// STUFF | |
}, false); |
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
let $field1 = document.querySelector('#field1'); | |
let $field2 = document.querySelector('#field2'); |
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
// https://api.jquery.com/ready/ | |
$(document).ready(function() { | |
// STUFF HERE | |
}); | |
// https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded | |
document.addEventListener('DOMContentLoaded', function() { | |
// STUFF HERE | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment