I don't understand how the variable works in 11/14



I passed the exercise, but I don't feel like I understand how this is happening. Can anybody explain it to me?

var toAdd = $('input[name=checkListItem]').val()


Hi @ragingamer333,

It's a CSS attribute selector. In this case, we have something like this:

<input type="text" name="checkListItem">

Since there's no way by default to select that specific element using CSS, you can use a CSS attribute selector like so:

input[name="checkListItem"] {
  /* styles */

You can see more information here:
https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors :slight_smile:


Thank you, I understand it now :smiley:


This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.