Your premier resource for jQuery library updates, tutorials, examples, tools, and community support.
New methods like .on() optimization. View details.
Optimized .each() and .find() methods. Learn more.
$(document).ready(function() {
$("#toggleBtn1").click(function() {
$("#toggleBox1").toggle(500);
});
$("#ajaxBtn1").click(function() {
$.get("https://api.jquery.com", function(data) {
$("#ajaxResult1").html("Loaded: " + data.length + " bytes");
});
});
});
More details in our official documentation.
$(document).ready(function() {
$("#fadeBtn").click(function() {
$("#fadeBox").fadeToggle(1000);
});
$("#addItemBtn").click(function() {
$("#dynamicList").append("Item " + ($("#dynamicList li").length + 1) + " ");
});
});
Explore more at jQuery Learn.
$(document).ready(function() {
$("#slideBtn").click(function() {
$("#slideBox").slideToggle(1000);
});
$("#validateBtn").click(function() {
var name = $("#nameInput").val();
if (name.length < 3) {
$("#validationResult").html("Name too short!").css("color", "red");
} else {
$("#validationResult").html("Valid name!").css("color", "green");
}
});
});
Check more at jQuery Official.