/* Jquery Introduction */ Hello.innerText = $; // init a function $(document).ready(function() { console.log("... The DOM is ready ..."); // runs when the DOM is ready Hello.innerText += "\nMore inner text"; // selectors derived from CSS selectors $('#Hello').addClass("green"); $('td').addClass("green"); // selectors and css $('td:even').css({ "background-color": "red", "font-size": "2em" }); // and so on ... $("td:last-child").html("<h1>Abrahadabra</h1>").css("color","black"); });
<div id="Hello"> Hello </div> <table> <tr> <td>One</td> <td>Two</td> <td>Three</td> </tr> </table>
.green { background-color: darkgreen; color: #fff; padding: 1.2em; }