--- id: bad87eee1348bd9aede07836 title: Set the id of an Element challengeType: 0 videoUrl: 'https://scrimba.com/c/cN6MEc2' forumTopicId: 18279 dashedName: set-the-id-of-an-element --- # --description-- In addition to classes, each HTML element can also have an `id` attribute. There are several benefits to using `id` attributes: You can use an `id` to style a single element and later you'll learn that you can use them to select and modify specific elements with JavaScript. `id` attributes should be unique. Browsers won't enforce this, but it is a widely agreed upon best practice. So please don't give more than one element the same `id` attribute. Here's an example of how you give your `h2` element the id of `cat-photo-app`: ```html

``` # --instructions-- Give your `form` element the id `cat-photo-form`. # --hints-- Your `form` element should have the id of `cat-photo-form`. ```js assert($('form').attr('id') === 'cat-photo-form'); ``` # --seed-- ## --seed-contents-- ```html

CatPhotoApp

Click here to view more cat photos.

A cute orange cat lying on its back.

Things cats love:

Top 3 things cats hate:

  1. flea treatment
  2. thunder
  3. other cats


``` # --solutions-- ```html

CatPhotoApp

Click here to view more cat photos.

A cute orange cat lying on its back.

Things cats love:

Top 3 things cats hate:

  1. flea treatment
  2. thunder
  3. other cats


```