Skip to content

Instantly share code, notes, and snippets.

@mars13code
Last active February 5, 2018 21:37
Show Gist options
  • Save mars13code/9504546230cd369e0d538cd38e386235 to your computer and use it in GitHub Desktop.
Save mars13code/9504546230cd369e0d538cd38e386235 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>jQuery</title>
</head>
<body>
<header>
<h1>TITRE1</h1>
</header>
<main>
<section>
<h2>TITRE2</h2>
</section>
</main>
<footer>
tous droits réservés
</footer>
<!-- http://code.jquery.com/ -->
<!-- charger le code de jQuery -->
<script src="https://code.jquery.com/jquery-3.3.1.min.js">
</script>
<!-- ajouter son code qui utilise jQuery ($) -->
<script>
$(function(){
// attendre que le DOM soit pret
// avant d'exécuter son code
// afficher une alerte quand on clique sur la balise h2
$('h2').on('click', function(){
alert('vous avez cliqué sur h2');
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment