Morning:
Afternoon:
div
, h1
, p
, etc.)#theID
, div#theID
, etc.).theClass
, p.theClass
, etc.)First make a new directory and then navigate into the new directory. Then start a new repository with git init
.
mkdir my_new_project
cd my_new_project
git init
To be able to make our first commit, we need to first add something to our empty project folder. A common first choice is a README.md
file, which is a document written in markdown that provides information about the project.
echo "# My New Project" >> README.md
git add .
git commit -m "Initial commit"
Once we have our first commit, we can add a ‘remote’ for our repository, like github or bitbucket. For github, log in to github.com, then hit the ‘+’ button in the top right of the screen to add a new repository. Then, it will give you the following commands to run from the command line.
git remote add origin git@github.com:myusername/my_new_project.git
git push -u origin master
This adds the github remote as ‘origin’ and sets it as the default for when you push your changes. From this point forward, just type git push
to push your changes to the remote.
<div class="person">
<h2 id="firstName">Han</h2>
<h2 id="lastName">Solo</h2>
<p>Made the Kessel Run in less than 12 parsecs</p>
<button>Click here to hire me!</button>
</div>
// Get all h2 elements with querySelectorAll. Returns a NodeList
const headings = document.querySelectorAll('.person h2')
console.log(headings) // [h2#firstName, h2#lastName]
// Get a single element with querySelector
const heading = document.querySelector('.person h2')
console.log(heading) // h2#firstName
// Do something when a click event occurs
const button = document.querySelector('button')
button.addEventListener('click', (ev) => {
alert('clicked!')
console.log(ev.target) // button
})
<h1>
).class
or an id
.)