Reference Website, i.e, make it work like this.
The above website is the official URL Shortener of Dayananda Sagar College of Engineering which is under active developement right now under @AmanL04.
Option Chosen | Selector Name | Changes to be made |
---|---|---|
New | #passwordUrl | Placeholder-> Enter Password |
New | #shortUrl | Placeholder-> Enter Desired Short URL |
New | #longUrl | Placeholder-> Enter Long URL |
New | #submitUrl | Text-> Shorten URL |
New | #new-update-search-url .horizontal-divider h3 | Text-> Optional Fields |
New | #current-option span | Text-> Shorten New URL |
--- | --- | --- |
Update | #passwordUrl | Placeholder-> Enter Old Password |
Update | #shortUrl | Placeholder-> Enter Old Short URL |
Update | #longUrl | Placeholder-> Enter New Long URL |
Update | #submitUrl | Text-> Update URL |
Update | #new-update-search-url .horizontal-divider h3 | Text-> Credentials |
Update | #current-option span | Text-> Update Existing Short URL |
--- | --- | --- |
Search | #longUrl | Placeholder-> Key to Search |
Search | #submitUrl | Text-> Search |
Search | #current-option span | Text-> Search from Existing URLs |
-
Add click event listener to #hamburger input. The callback function should:
- Remove class show from #search-result
- Toggle class checked to #hamburger-menu ul based on the condition "e.target.checked == true"
OUTCOME- On clicking the hamburger menu on the top right, the menu opens.
-
Add click event listener to each li selected by #hamburger-menu li. The callback function should:
- Store innerText of the e.target in lowercase in a variable named option [e.target.innerText.toLowerCase()].
- Remove class checked from the parent element of the target.
- Make className property of element with id #new-update-search-url equal to option.
- Make className property of element with id #new-update-result equal to option.
- Make value of element with id #shortenedResult as empty string.
- Make checked property of element with selector #hamburger input as false.
- Make value of all input fields in the form empty string. (Search and learn how to do).
- Paste this code (inside the callback function only)
switch(option){ case "new": newUrlFn();break; case "update": updateUrlFn();break; case "search": searchUrlFn();break; }
- Outside the callback function define these 3 functions
function newUrlFn(){ // Some code } function updateUrlFn(){ // Some code } function searchUrlFn(){ // Some code } // Some code - This you should think and do. // Hint 1: Change placeholder values of the input fields according to the option. // Hint 2: Show/Hide certain input fields based on the chosen option (Mentioned at the start).
OUTCOME - On clicking anyone of the menu options, accordingly the form will change.