Skip to content

Instantly share code, notes, and snippets.

@ryanorsinger
Created September 29, 2014 17:47
Show Gist options
  • Save ryanorsinger/44d2e378b355001fe01f to your computer and use it in GitHub Desktop.
Save ryanorsinger/44d2e378b355001fe01f to your computer and use it in GitHub Desktop.
jQuery selectors - id, class, and element selectors. Method chainingl
<html>
<head>
<title>Exampe jQuery Page</title>
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
</head>
<body>
<h1 id="codeup">Hello Codeup</h1>
<ul class="codeup">
<li>$ is an alias of `jQuery` to reference the jQuery object.</li>
<li>JS natively has `window.onload = function() { console.log('The page has finished loading');`</li>
<li>$(document).ready(function() { console.log( 'The DOM has finished loading!' ); });`</li>
</ul>
<script>
$('document').ready(function() {
var contents = $('#codeup').html();
alert('The html of the id 'codeup' is ' + contents);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment