Skip to content

Instantly share code, notes, and snippets.

View nextechu's full-sized avatar

Bruce Kyle nextechu

View GitHub Profile
<p id="hellothere">Hello World</p>
.. omitted code
//Select the element by it's ID
alert($("#hellothere").text()); // Hello World
<p id="hello">Hello World</p>
.. omitted code
//Select the element by it's ID
var element = $("#hello");
<p class="hello">Hello</p>
<p class="hello">World</p>
<script>
//Select both element by it's class
var elements = $(".hello");
</script>
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<p id="hellothere" class="hello">Hello</p>
<p class="hello">World</p>
<script src="Scripts/jquery-2.1.0.js"></script>
<script>
$(document).ready(function () {
//Code here
});
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<p id="hellothere" class="hello">Hello</p>
<p class="hello">World</p>
<script src="Scripts/jquery-2.1.0.js"></script>
<script>
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<p id="hellothere" class="hello">Hello</p>
<p class="hello">World</p>
<script src="Scripts/jquery-2.1.0.js"></script>
<script>
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div>
<div id="div1">My div with id attribute of div1</div>
if ($(“div”).length) {
//do something.
}
@nextechu
nextechu / minimal-skeleton.html
Last active January 3, 2016 04:49
Minimal skeleton for HTML5 app.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Your title</title>
</head>
<body>
The document content
</body>