jquery
(PDF)
Posted February 22nd, 2024
jquery is a javascript library that simplifies DOM management.
Basic Jquery Cheatsheet:
Get it from: https://jquery.com/download Run on Load <script> $(document).ready(function() { }); </script> Reference a type (e.g. a button) $("typename").addClass("foo"); Reference a class: $(".classname").addClass("foo"); Reference an id: $("#idname").addClass("foo"); Functions: ---------- css - add css rule to element Sample $(#myid).css('background-color','red'); Note that its a comma between elements, not a colon addClass - adds a class to an element removeClass -removes a class from an element html - sets body of element text - set element text without evaluating remove - removes an element appendTo - appends selected element to new target Sample: $("#myid").appendTo("#target2"); clone - create a clone Sample: $("#myid").clone().appendTo("#target2"); parent - finds parent element of element selected. children - finds children elements of element selected. nth-child - finds nth child of element |