Workshop 9: Exercise 2: Basic Dom Scripting

Back to Workshop 9 index

Exercise 2: Basic Dom Scripting

So far, we have created JavaScript by hooking the code to a button etc. A good way to learn jQuery (and JavaScript) is to try things in the console. So open the Developer Tools (F12) and try to accomplish the following tasks.

How would you:

  1. Find a reference to all H3 -tags?
  2. Find a reference to div with an id='contant' and replace the contents with a text of your choice else?
  3. Find a reference to the img and replace the src attribute with some other image online?
  4. Find the element with a class sideBarListBox and show/hide it?
  5. Find any li element that contains the text "Lorem" and add css underline -attribute to them?
  6. Find all the anchor tags within the class SideBarListBox and apply css modifications of your choice to them.