Graduation - 2010
Web applications since 2009
UI Engineer - Avenue Code
DOM manipulation
Animation
Ajax
Event handling
<script src="jquery-x.xx.x.min.js"></script>
<script src="yourScript.js"></script>
// html() method $("#elementId").html("Good Morning Coltec!"); // append $(".elementsClass").append("<div>Inserted After</div>");
// prepend $("#elementId div").prepend("<div>Inserted before</div>");
// Has Class $("#elementId").hasClass("className"); // Add/Remove Class $(".elementsClass").addClass("class"); $(".elementsClass").removeClass("class");
// Toggle $("#elementId div").toggleClass("selectedClass");
<div class="product" data-product-code="123">...</div>
//accessing product code
$("elementId").data("product-code");
// css method $("#selector").css({ 'display': 'block', 'top': '2px'}); // width and height $("#selector").width([value]);
$("#selector").height([value]);
// Visibility $("#selector").fadeIn(); $("#selector").fadeOut();
$("#selector").toggle();
// Animate
$("#selector").animate({height: "100px"}, 5000);
$.ajax({ url: "test.html"})
.done(function(data) { $(body).html( data ); })
.fail(function() { $(body).html( "Something is wrong" ); })
.always(function(){ // do something });
Done, fail and always callbacks
$.getJSON( "/project.json", function(data){ // ... });
// Mouse events $("#selector").click(function(e){}); $("#selector").mouseenter(function(e){}) $("#selector").mouseleave(function(e){}); $("#selector").hover( function(e){// enter}, f unction(e){// leave} ); // Click $("#selector").click(function(e){});
// Document
$(document).ready(function{// DOM is loaded});
// On
$("#selector").on("click", function(){});