• JQUERY > Premiers pas et mise en place

      1 - TELECHARGER JQUERY

      https://jquery.com

      2 - INCLURE LE CHEMIN DE JQUERY

      Il faut renseigné le chemin juste avant la balise </BODY>

       

      <html>
         <head>
         ...
         </head>
         <body>
         ...
         <script src="chemin/vers/jquery.js"></script>
         </body>
      </html>

      3 - APPEL DE LA FONCTION

       

      $(function() {
         console.log( "ça marche!" );
      });

       

      Cette fonction peut être appelée de 2 manières :

       

      Directement depuis le HTML

      Bien évidemment, après avoir renseigné le chemin

       

      <script src="chemin/vers/jquery.js"></script>
      <script>
      $(function(){
         // du code...
      });
      </script>
      </body>
      </html>

       

      Via un fichier JS

      <script src="chemin/vers/jquery.js"></script>
      <script src="chemin/vers/mon-script.js"></script>
      </body>
      </html>

       

      où le fichier mon-script.js contiendra :

       

      $(function(){
         // du code...
      });

      4 - EXEMPLE SIMPLE

      $(‘élément’).méthode();

       

      ou

       

      $('élément').méthode(function(){
         ...
      });

       

      ou

       

       

 

Aucun commentaire

 

Laissez un commentaire