INSTRUCTIONS:
- Simply develop and submit the code to fulfill the requirements of this assignment
- Do not forget to write your name and date.
I declare that this assignment is my own work in accordance with Lambton Academic Policy
No part of this assignment has been copied manually or electronically from any other source (including web sites) or distributed to other students.
First Name:
Last Name:
Student ID:
Date:
In this assignment, you are required to use JavaScript to perform the following:
1 – A function that removes all text fields from the webpage.
2 – A function that creates and appends a paragraph to the page. The text for the paragraph should be: “New Paragraph Added”. Set the font color to be green and the font size to 12.
3 – A function that takes one parameter and uses it as the id for an existing element in the page. Then, removes that element from the page. If such id does not exist on the page, an error message should be displayed in the console.
4 – A code to add a click event to the button “Click Me” on the page. Once the button is clicked, a paragraph will be added to the page. Assume that the button already exists on the page.
5 – Create a button on the page “Hover Your Mouse Here”. Once the mouse hovers on this button, the background of the button should get changed to red. Once the mouse leaves this button area, the background color should get changed back to the default value. Once the button is clicked, a duplicated of this button should be added to the page with exact the same event properties.
To submit:
Follow these steps to submit your work successfully:
1. Create a file and name it as firstName_lastName_A1
2. Write down your information on top of this document
3. Convert to PDF and upload on the Moodle.
Answers:
1.
Code
Screenshot of the output
2.
Code
Screenshot