jQuery fue creado en 2006 por John Resig. Fue diseñado para manejar incompatibilidades del navegador y simplificar la manipulación HTML DOM, el manejo de eventos, las animaciones y Ajax.
Durante más de 10 años, jQuery ha sido la biblioteca de JavaScript más popular del mundo.
Sin embargo, después de la versión 5 de JavaScript (2009), la mayoría de las utilidades de jQuery se pueden resolver con unas pocas líneas de JavaScript estándar:
Ocultar un elemento HTML:
myElement.hide();
Pruébelo usted mismo →
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
</head>
<body>
<h2>Get Text Content</h2>
<p id="01">Hello World!</p>
<p id="02">Hello Sweden!</p>
<p id="03">Hello Japan!</p>
<p id="demo"></p>
<script>
$(document).ready(function() {
$("#02").hide();
});
</script>
</body>
</html>
myElement.style.display = "none";
Pruébelo usted mismo →
<!DOCTYPE html>
<html>
<body>
<h2>Hide HTML Elements</h2>
<p id="01">Hello World!</p>
<p id="02">Hello Sweden!</p>
<p id="03">Hello Japan!</p>
<script>
document.getElementById("02").style.display = "none";
</script>
</body>
</html>
Mostrar un elemento HTML:
myElement.show();
Pruébelo usted mismo →
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
</head>
<body>
<h2>Show HTML Elements</h2>
<p id="01" style="display:none">Hello World!</p>
<p id="02" style="display:none">Hello Sweden!</p>
<p id="03" style="display:none">Hello Japan!</p>
<script>
$(document).ready(function() {
$("#02").show();
});
</script>
</body>
</html>
myElement.style.display = "";
Pruébelo usted mismo →
<!DOCTYPE html>
<html>
<body>
<h2>Show HTML Elements</h2>
<p id="01" style="display:none">Hello World!</p>
<p id="02" style="display:none">Hello Sweden!</p>
<p id="03" style="display:none">Hello Japan!</p>
<script>
document.getElementById("02").style.display = "";
</script>
</body>
</html>
Cambiar el tamaño de fuente de un elemento HTML:
$("#demo").css("font-size","35px");
Pruébelo usted mismo →
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
</head>
<body>
<p id="demo">Change the style of an HTML element.</p>
<script>
$(document).ready(function() {
$("#demo").css("font-size","35px");
});
</script>
</body>
</html>
document.getElementById("demo").style.fontSize = "35px";
Pruébelo usted mismo →
<!DOCTYPE html>
<html>
<body>
<p id="demo">Change the style of an HTML element.</p>
<script>
document.getElementById("demo").style.fontSize = "35px";
</script>
</body>
</html>