Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this project, youll use a conditional statement to check forbrowser support of the HTML5 placeholder feature, and execute codeto replicate this feature if the

In this project, you’ll use a conditional statement to check forbrowser support of the HTML5 placeholder feature, and execute codeto replicate this feature if the condition returns a flasyvalue.

Within the (script) section you created in the previous step,enter the following function:

function insertPlaceholders() {

if(!Modernizr.input.placeholder) {

document.getElementById(“nameinput”).value =

“first and lastname”;

document.getElementById(“emailinput”).value =

“address@example.com”;

document.getElementById(“phoneinput”).value =

“###-###-####”;

}

}

This code references the placeholderproperty of the input property of the Modernizr object. TheModernizr library, which is linked to this document, is commonlyused on the web to enable developers to create the same or similarexperiences on both modern and older browsers. When a webpage that uses Modernizr is opened in a browser, the libraryqueries the browser to determine if it supports specific featuresused by the site.

Below the code for the function, add the followingbackward-compatible event listener to call the function when thewindow finishes loading:

if (window.addEventListener) {

window.addEventListener(“load”, insertPlaceholders, false);

} else if (window.attachEvent) {

window.attachEvent(“onload”, insertPlaceholders);

}

The text:


Hands-on Project 3-2

<(script)src="modernizr.custom.58072.js"><(/script)>







Hands-on Project 3-2


ContactInformation

Name



Email

Phone


<(script)>


<(/script)>


Step by Step Solution

3.29 Rating (146 Votes )

There are 3 Steps involved in it

Step: 1

It looks like youre working on a project to check for browser support of the HTML5 placeholder featu... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Management Information Systems Managing the Digital Firm

Authors: Ken Laudon, Jane P. Laudon

13th edition

133050696, 978-0133050691

More Books

Students also viewed these Programming questions

Question

What is a lobbyist in US? How did this term emerge?

Answered: 1 week ago