jQuery 3 - Home Page
Fill In The Blank
Views 177
Answer:
1. jQuery 3 - Home Page
• Write a function login() that will redirect to home.html after clicking the login button.
• Use username= "admin", and password="password". Else, show an alert message "You are not a valid user".
• Make sure you use the doRedirect() function provided in the index.js file to redirect from index.html to home.html.
index.htmlscript.js
Write your code in this function
script.jsfunction login() { }; function doRedirect(href) { window.location = href; };
Updated Code
function login() { var username = $('#username').val(); var password = $('#password').val(); if (username === "admin" && password === "password") { doRedirect('home.html'); } else { alert("You are not a valid user"); } } function doRedirect(href) { window.location = href; };
Related Articles:
This section is dedicated exclusively to Questions & Answers. For an in-depth exploration of jQuery, click the links and dive deeper into this subject.
Join Our telegram group to ask Questions
Click below button to join our groups.