Question: So, I have a dynamic number of list items and I would like to apply a style to the second to last.... IF only there are an even number of elements.

```
<ul>
  <li>One</li>
  <li>Two</li>
  <li>Three</li>
  <li>Four</li>
</ul>

```

I want to apply style to the Three li element in the above case, but nothing if as follows.

```
<ul>
  <li>One</li>
  <li>Two</li>
  <li>Three</li>
</ul>

```

Answer: 
The issue seemed to be with the `@Html.EditorFor` helper. I changed my code and now it's working.

```
<div class="form-group">
    @Html.LabelFor(model => model.Approved, htmlAttributes: new {@class = "control-label col-md-2"})
    <div class="col-md-2">
        @Html.CheckBoxFor(model => model.Approved, new { onclick = "SingleCheckbox(this)" })
        @Html.ValidationMessageFor(model => model.Approved, "", new {@class = "text-danger"})
    </div>
</div>

<div class="form-group">
    @Html.LabelFor(model => model.Rejected, htmlAttributes: new { @class = "control-label col-md-2" })
    <div class="col-md-2">
        @Html.CheckBoxFor(model => model.Rejected, new { onclick = "SingleCheckbox(this)" })
        @Html.ValidationMessageFor(model => model.Rejected, "", new {@class = "text-danger"})
    </div>
</div>

```

I just have to update the javascript to be more generic, I may want to use this in other areas of the site.
Try this hopefully it will render the required markup having onclick in it

```
@Html.EditorFor(model => model.Approved, new { @onclick = '"SingleCheckbox.call(this)"' })

```