(ง •̀_•́)ง Ming and Her Code

References

jQuery is one of the many libraries for JavaScript. It is designed to simplify scripting done on the client side. jQuery’s most recognizable characteristic is its dollar sign ($) syntax. With it, you can easily manipulate elements, create animations and handle input events.

Cover topics

Basic

// dollar sign operator/ bling
$(document).ready(function(){
  //animate.css library

//target elements by type, class and id
$("button").addClass("animated bounce");
$(".well").addClass("animated shake");
$("#target3").addClass("animated fadeOut");

//remove class
$("button").removeClass("btn-default");

//changing css
$("#target1").css("color","red");

//disable an element
$("#target1").prop("disabled",true);

//changing html (other function .text())
$("h3").html("<em>jQuery Playground</em>");

//remove element
$("#target4").remove();

//move element
$("#target2").appendTo("#right-well");

//clone element
$("#target5").clone().appendTo("#left-well");

//target the parent of an element
$("#target1").parent().css("background","red");

//target the children of an element
$("#right-well").children().css("color","orange");

//target a specific child of an element,  target:nth-child(n)
$(".target:nth-child(2)").addClass("animated bounce");

//target even or odd element
$(".target:even").addClass("animated shake");

//target entire page
$("body").addClass("animated hinge");
});

back to top