Quiz

  1. Are these quizzes graded for correctness or completeness? I feel like sometimes there are trick questions, which trip me up.

    I'm sorry that you feel they are tricky. I don't intend them to be tricky. Please talk to me about this.

  2. I am still a bit confused about the concept of API

    It's an interface between parts of a program, whether you (or your team) wrote both parts or whether one part is a library that other folks created. When you do import random in Python or Java, that's an API.

  3. I’m still confused about what the DOM is conceptually, and how does it relate to HTML? They seem quite similar.

    The DOM is an API that allows JS to dynamically modify the page, including the HTML and the CSS. So, yeah, they are similar. But HTML was originally intended to be written by humans, and so it was static. The DOM allows it to be dynamic.

  4. I’m having difficulty loading jQuery - should I be putting the code somewhere other than my browser console? I keep getting a SyntaxError.

    There is a way to load it dynamically, but I always load it with a script tag in the HTML page.

  5. Why use JQuery when there is already Javascript? Is it when there's so little Javascript neede for a file it doesn't make sense to create another JS file?

    You are right that JQuery is not strictly necessary. But we use libraries because they make things easier. JQuery makes working with the DOM a little easier.

    Avoiding loading extra files can be part of the decision, but programmer effort is important as well.

  6. I still don't really understand H3 events. Can you explain why we use them and hos they are helpful?

    H3 events aren't a thing. That was just a section header that I used as an example. Let's look at it together: click example

  7. When do you use a #before an id? / Difference between adding # to the name and without #. Is # for element and no # like "P" is for the known ones?

    When we give something ID, we can refer to the thing using the hashtag character and the id.

    
        $("body").append("

    this is an example

    "); $("#example").css("color","red");
  8. I would like to know more about the hashtags used.

    They can also be used in URLs, to go directly to a location on the page

  9. For JQuery methods, what are the differences between attr and CSS, and what are the differences between text and HTML.

    Excellent and subtle questions!

    attr allows you to change any attribute, such as the src of an image (useful for image swaps). css allows a more structured way to modify the style attribute.

    text and html are very similar. They are identical for text, but differ in how they handle HTML code.

    
    $("#example").text("hello there");
    $("#example").html("hello there");
    $("#example").text("well, hello");
    $("#example").html("well, hello");
    
    

    Using the html() method is good when the HTML is not trustworthy, as with user-contributed content.

  10. Could we go over other examples of DOM events

    Here's a list of some common events which links to a longer list. We'll stick with click for a while and introduce others when needed

  11. A clarifying question: is an "event handler" just a function that deals with user-initiated events?

    Yes.

  12. Regarding the part about “The Click Method”, it mentions the browser will invoke the function when the event happens. Does this just mean that the function doesn’t do anything until the header is being clicked on (the event happening), and that's when the function is invoked and runs to change it to a random color? Am I understanding this correctly?

    Correct!

  13. how the find command works, I am very unsure about the syntax of that

    The find method is most useful when searching a subtree:

    
        $("a");  // finds all hyperlinks on the page
        $("nav").find("a");   // finds all hyperlinks in the NAV element
    
    
  14. Probably a bit more on implementing chaining

    Sure. Just have the method return the object. Amazing

  15. No. I think I just need more practice of JQuery

    Don't we all?

  16. How did you create the plugin? Is that something that we might be able to learn in this class as well? / Plugins

    I won't teach that in class, but I'm happy to talk in OH.

  17. I'm curious about the challenge question! Couldn't figure it out, but interested.

    Let's talk in OH

  18. None! :) / I think I got everything!

    Great!