After the user enters the phone number, pop up a Good Luck alert message ➢ use onblur and name your function goodLuck()
HTML BASED QUESTION
After the user enters the phone number, pop up a Good Luck alert message ➢ use onblur and name your function goodLuck()
❖ Add an empty paragraph just below the name field. After the user enters the name, populate the new paragraph with the text “Have we met before, ?”
❖ Add an empty paragraph just below the select field. After selecting a favorite dish, change the background color of the select paragraph and the new paragraph to a new color, and add text to the new paragraph that says “Good choice”.
❖ Add an empty paragraph just below the restaurant rating field. When the user selects 4 or below, add text to the new paragraph that says “Are you sure?”; when the user selects 6 or above, use the text “Great”.
❖ When the user clicks Reset, show an alert that says “Get it right this time!” and change the background of the page to a bright color.
❖ Add an empty paragraph just below the Submit button area. When the user clicks Submit, first check that the phone number is not empty. If it is empty, add text to the paragraph that says “Tricked you--phone number is required!” and prevent the submission. The text should be in red color, with a gray background for the paragraph. If the phone field is NOT empty, then add text to the paragraph that says “Thanks--can I call you tomorrow?”. You choose the colors for this one, but make it different than the red and gray.
****************************************************************
Here is the code i have so far
<!DOCTYPE html>
<html>
<head> Donta's Food Fusion </head>
<head lang=“en”>
<title> Donta's Food Fusion </title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
<body>
<br/>
<div> Survey </div>
<div>
<br/>
<hX> Help us serve you better :
<br/>
<form>
<legend> Survey</legend>
<p>
<label> First Name: </label>
<input type="text" name="fName" />
</p>
<p>
<label> Last Name: </label>
<input type="text" name="lName" />
</p>
<p> "Have we met before <insert the name he/she typed here>?" </p>
<p>
<label> Email Address: </label>
<input type="email" name="email" />
</p>
<p>
<label> Phone Number: </label>
<input type="tel" name="phone" />
</p>
<input type="text" onblur="GoodLuck()">
<script>
function GoodLuck() {
alert("Good Luck");
}
<p>
<label>Favorite Dish:</label>
<select name="favorite">
<option>Choose your favorite dish</option>
<option>Chicken & Waffles</option>
<option>French Toast</option>
<option>Bacon Burger</option.
<option>Pizza</option>
<option>Bacon Cheese Fries</option>
<option>Bonless Wings</option>
<option>Chicken Alfredo</option>
<option>Ribeye Steak</option>
</select>
<p> "Good choice" </p>
</p>
<p>
<label>Rating of Restaurant</label>
Bad
<input type="range" min="0" max="10" step="1" name="happiness" />
Good
</p>
<p>
<label>Date: <br/>
<input type="date" .../>
</p>
<p>
<input type="time" .../>
</p>
<p>
<label> Permission to publish survey</label>
<input type="checkbox" name="yes" name="no"
</p>
<p>
<label> Comments: </label>
<textarea rows="3" cols="25">Text<textarea>
</p>
<input type="submit" />
<input type="reset"/>
</form>
<footer>
Copyright 2021 </footer>
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images