Skip to content

Instantly share code, notes, and snippets.

@rogerwschmidt
Created May 17, 2017 21:54
Show Gist options
  • Save rogerwschmidt/e4020efed798eedab5c5296793f27113 to your computer and use it in GitHub Desktop.
Save rogerwschmidt/e4020efed798eedab5c5296793f27113 to your computer and use it in GitHub Desktop.

jQuery / Complete DOM Exercises

Objectives

Load jQuery on your HTML page.

Create a script tag that adds jQuery to an HTML page with the following src

https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js

Access and replace the content of HTML elements with jQuery.

Access the p with id "content" and add the string 'this is content' as content

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    <title>repl.it</title>
    <link href="index.css" rel="stylesheet" type="text/css" />
  </head>
  <body>
    <div id="section">
      <p id="content"></p>
    </div>
    
    <script src="index.js"></script>
  </body>
</html>

Use jQuery to create new, and add elements in HTML pages.

Add a new paragraph elemnt as a child of the div tag with id "section". In this new paragraph, 
have the content read 'This is dynamically generated content'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment