Extra Credit Assignment 3.4

by Lucille Kenney

HTML

<button id="btn">Click</button>

<h1 id="first_H1">First H1 Header</h1>
<p class="first_paragraph">This is my first paragraph.</p>
<p>This is my second paragraph.</p>
<p>This is my third paragraph.</p>

<h1 id="second_H1">First H1 Header</h1>
<p class="first_paragraph">This is my first paragraph.</p>
<p>This is my second paragraph.</p>
<p>This is my third paragraph.</p>

<ul>
    <li>First Item</li>
    <li>Second Item</li>
    <li>Third Item</li>
</ul>

JavaScript

/* Lucille Kenney, Extra Credit Assignment 3 */
/*
document.addEventListener("mousedown", function(event) {
    //console.log("mouse down." + event.clientX + ", y: " + event.clientY);
});
*/

/*var btn = document.getElementById("btn");
btn.addEventListener("mousedown", function(event) {
    console.log("mouse down." + event.clientX + ", y: " + event.clientY);
});*/

/*document.addEventListener("mousedown", function(event) {
    var els = document.getElementsByClassName("first_paragraph");
        for(var i = 0; i < els.length; i++){
    console.log(els[i]);
    }
});*/

/*document.addEventListener("click", function(event) {
    var els = document.getElementsByTagName("li");
        for(var i = 0; i < els.length; i++){
    console.log(els[i]);
    }
});*/

document.addEventListener("click", function(event) {
    var els = document.querySelectorAll("p.first_paragraph");
        for(var i = 0; i < els.length; i++){
    console.log(els[i]);
    }
});