Nerd For Tech
Published in

Nerd For Tech

Assessing the Assessments (part 3)

This is my third post about LinkedIn’s HTML assessment. In my previous posts, I mostly discussed HTML elements that appeared in the questions and/or lists of possible answers. In this and my next post, I’ll discuss attributes that I saw on the assessment.

About Attributes

Even if you’re new to HTML, you’ve probably come across items in an element’s opening tag that are composed of a word or several letters followed by “=”, which in turn is followed by some text enclosed in quotation marks. A common one is href:

<a href=”https://medium.com/”>Medium</a>

The href is an example of an HTML attribute. This and other attributes play an important role in HTML. As W3Schools.com says, “HTML attributes provide additional information about HTML elements.” The href attribute, for instance, indicates what a link actually links to. Another is src, such as you’ll see in <img> tags.

<img src=”pretty-picture.jpg”>

The src attribute indicates what image the tag is supposed to display.

Let’s take a look at a few of the attributes found on the LinkedIn assessment.

Got Any ID? Or Class?

The assessment asked about the class attribute and the id attribute. You may be most familiar with these two attributes as they relate to CSS. Adding an id or class attribute to an element allows you to style the element in a particular way. The main difference between the two is that multiple elements in an HTML document can be assigned to the same class, whereas an id can only apply to one element in an HTML document.

Here’s a question that appeared on the assessment:

In this code, what is the purpose of the id attribute?

<p id=”warning”>Be careful when installing this product.</p>

You should be able to immediately eliminate the choice in the answer list which says that the id can be used for styling several times per page. The other answers correctly state that “id is a unique identifier”. However, one answer states that it is a unique identifier in the website, while the others state that it is a unique identifier in the document. Which assertion is correct? As indicated above, the id attribute can only apply to one element in an HTML document, so we can eliminate the answer that states it’s a unique identifier in the website. The remaining choices are similar, with a key difference. One says, “It establishes that id is a unique identifier in the document, used for styling CSS and with JavaScript code.” Sounds like a good choice, but the other option mentions another use for this attribute: “linking within a web page.” Yes, we can use an id attribute for JavaScript (such as with the getElementById() method), yet don’t forget that we can use an id in anchor tags to link to a particular place on a web page.

The answers for the question about the class attribute’s purpose also have subtle enough differences that you may need to stop and read them closely before choosing. All of them correctly state that classes allow CSS to select specific elements on the page. Two of them also mention that this works for JavaScript as well as CSS, which is in fact the case (e.g., the getElementsByClassName() method). The key to choosing which of those two is correct lies in knowing whether the class attribute can hold only one or more than one class name. Do you know? The correct answer to choose is the one that says, “You may list as many class names within the class attribute as you wish, separated by spaces.”

Testy Textareas

Another question asked which of the four possible answers was not a valid attribute for the <textarea> element. The choices were readonly, max, spellcheck, and form. Prior to reviewing for the assessment, I probably would not have been able to answer this one correctly — except by lucky guess. In fact, I was not even aware that there was a spellcheck attribute.

As a reminder… <textarea> is for “multi-line plain-text editing control, useful when you want to allow users to enter a sizeable amount of free-form text.” Mozilla Developer Network lists 16 attributes for this element:

  • autocapitalize
  • autocomplete
  • autocorrect
  • autofocus
  • cols
  • disabled
  • form
  • maxlength
  • minlength
  • name
  • placeholder
  • readonly
  • required
  • rows
  • spellcheck
  • wrap

Thus, we can easily conclude that the correct answer to the question is max. You can use maxlength, but not max, with <textarea>.

Enctype(?)

This attribute was new to me. Here’s the question from the assessment:

What should fill the blank in the HTML below?

<form method=”post” action=”mailto:info@linkedin.com” ____=”text/plain”>

The possible answers were type, media, enctype, and rel. My first though was type, but that attribute cannot be used with the <form> element. A little searching revealed that the correct choice would have been enctype, which is used with <form> to indicate “how the form-data should be encoded when submitting it to the server.” By the way, in addition to “text/plain”, this attribute can have a value of “application/x-www-form-urlencoded” or “multipart/form-data.”

I’m sure this is one of the not-so-well-known HTML attributes, and in one of the YouTube videos I watched to prepare myself for the assessment, the person who was taking it — a web developer with over 3 years experience — didn’t know the answer to the question and guessed incorrectly. So don’t feel bad if any of the assessment questions stump you.

I’ll finish up my discussion about HTML attributes I encountered on the assessment in my next post.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Lyndel Barnes

Lyndel Barnes

Lyndel holds an MA in English and has worked in customer service, education and insurance. He recently finished Flatiron School's software engineering program.