jQuery
fullCalendar
Tree Structure
DOM ready
$(document).ready(function(){
console.log("ready!");
});
//Shorthand for $( document ).ready()
$(function(){
console.log("ready!");
});
Avoiding Conflicts with Other Libraries
var $j = jQuery.noConflict();
// $j is now an alias to the jQuery function; creating the new alias is optional.
jQuery.noConflict();
jQuery( document ).ready(function( $ ) {
// You can use the locally-scoped $ in here as an alias to jQuery.
$( "div" ).hide();
});
jQuery.noConflict();
(function( $ ) {
// Your jQuery code here, using the $
})( jQuery );
DOM Selector
// Refining selections.
$( "div.foo" ).has( "p" ); // div.foo elements that contain <p> tags
$( "h1" ).not( ".bar" ); // h1 elements that don't have a class of bar
$( "ul li" ).filter( ".current" ); // unordered list items with class of current
$( "ul li" ).first(); // just the first unordered list item
$( "ul li" ).eq( 5 );
$("#id1, #id2").text();
$("#select_id option:selected").text();
$("input[id^='boh_ilsu']").each(function(idx,element){})
:password
:reset
:radio
:text
:submit
:checkbox
:button
:image
:file
$( "form :input" );
$('input[id$="_ym"]').blur(); // id가 '_ym'으로 끝나는 것을 선택
Attributes
// setter
$( "a" ).attr( "href", "allMyHrefsAreTheSameNow.html" )
$( "a" ).attr({
title: "all titles are the same too!",
href: "somethingNew.html"
});
// getter
$( "a" ).attr( "href" ); // Returns the href for the first a element in the document
Selecting Elements
$( "#myId" ); // Note IDs must be unique per page.
$( ".myClass" ); // Selecting Elements by Class Name
$( "input[name='first_name']" ); // Selecting Elements by Attribute
$( "#contents ul.people li" ); // Selecting Elements by Compound CSS Selector
$( "div.myClass, ul.people" ); // Selecting Elements with a Comma-separated List of Selectors
Pseudo-Selectors
$( "a.external:first" );
$( "tr:odd" );
// Select all input-like elements in a form (more on this below).
$( "#myForm :input" );
$( "div:visible" );
// All except the first three divs.
$( "div:gt(2)" );
// All currently animated divs.
$( "div:animated" );
Choosing Selectors
// Doesn't work!
if ( $( "div.foo" ) ) {
...
}