Posts

Showing posts from April, 2024

Event Handling and DOM Manipulation - Basic Tasks

Here are a couple of tasks related to event handling and DOM manipulation. These are very basic and micro level tasks. I suggest to complete these before moving to complex ones or JavaScript assignment. Most of these tasks are designed to practice common use cases of form handling, event handling and DOM manipulation. So do not worry, if you feel, a task do not represent genuine requirement. Task 1 Get a number from user in a text field. Add a standard button below that field. When the button is clicked, in alert box, show the square of number. e.g. if user entered 6, in alert, show 36. Task 2 Create two text input fields to get two numbers from user. Make a group of radio buttons with options: Add, Subtract, Multiply, and Divide. Then, add a standard button labled "Calculate", when the button is clicked, perform the selected arithmatic operation and display the result in a div below the button. Task 3 Make a hyperlink and set values for following attributes: href, title, tar