YouTip LogoYouTip

jQuery Tutorial - Getting Started

jQuery Basics

// Select and manipulate
$("h1").text("New Title");
$(".box").css("color", "red");
$("#main").addClass("active");

// Events
$("button").click(function() {
    alert("Clicked!");
});

// AJAX
$.get("/api/data", function(data) {
    console.log(data);
});

Summary

  • $() selects elements
  • Methods chain: $(sel).css().addClass()
← Node.js Tutorial - Getting StaBootstrap Tutorial - Getting S β†’