Skip to content

Instantly share code, notes, and snippets.

View carlosrojaso's full-sized avatar
🎯
Focusing

Carlos Rojas carlosrojaso

🎯
Focusing
View GitHub Profile
@carlosrojaso
carlosrojaso / gist:8b055bd3541452cfdc85
Created May 15, 2014 10:35
CSS, Styling, & Dimensions
// Setting CSS properties.
$( "h1" ).css( "fontSize", "100px" ); // Setting an individual property.
// Setting multiple properties.
$( "h1" ).css({
fontSize: "100px",
color: "red"
});
// Viewing the number of <h1> tags on the page.
var allHeadings = $( "h1" );
alert( allHeadings.length );
@carlosrojaso
carlosrojaso / gist:02d285db4fefcc086eb7
Created May 15, 2014 10:21
Working with Selections
// The .html() method used as a setter:
$( "h1" ).html( "hello world" );
// The .html() method used as a getter:
$( "h1" ).html();
$( "#myId" ); // Note IDs must be unique per page.
$( ".myClass" );
@carlosrojaso
carlosrojaso / gist:78f7c01c1e022c03be03
Created May 15, 2014 10:16
link The .attr() method
$( "a" ).attr( "href" ); // Returns the href for the first a element in the document
@carlosrojaso
carlosrojaso / Putting jQuery Into No-Conflict Mode
Created May 15, 2014 10:10
JQuery Putting jQuery Into No-Conflict Mode
<!-- Putting jQuery into no-conflict mode. -->
<script src="prototype.js"></script>
<script src="jquery.js"></script>
<script>
var $j = jQuery.noConflict();
// $j is now an alias to the jQuery function; creating the new alias is optional.
$j(document).ready(function() {
$j( "div" ).hide();
@carlosrojaso
carlosrojaso / $( document ).ready()
Created May 15, 2014 10:07
Jquery $( document ).ready()
<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script>
$( document ).ready(function() {
console.log( "document loaded" );
});
$( window ).load(function() {
console.log( "window loaded" );
@carlosrojaso
carlosrojaso / Query: The Basics
Created May 15, 2014 09:46
Query: The Basics
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Demo</title>
</head>
<body>
<a href="http://jquery.com/">jQuery</a>
<script src="jquery.js"></script>
<script>
break
case
catch
class
const
continue
debugger
default
delete
do
// Stopping a loop
for ( var i = 0; i < 10; i++ ) {
if ( something ) {
break;
}
}