Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

2
Having difficulty to add a class to a tag
Post Body

I am trying to add a class to a tag html via jquery but something is going wrong I get the element but it's not adding the class I don't get what I am missing:

//HTMl

<ul class="cm-nav-list">

<li class="cm-nav-list\\\_\\\_item cm-nav-list\\\_\\\_item--item1 is-active">

<span class="span1">Label1</span>

<span class="span2">Label2</span>

</li>

<li class="cm-nav-list\\\_\\\_item cm-nav-list\\\_\\\_item--item2">

<span class="span1">Label1</span>

<span class="span2">Label2</span>

</li>

<li class="cm-nav-list\\\_\\\_item cm-nav-list\\\_\\\_item--item3">

<span class="span1">Label1</span>

<span class="span2">Label2</span>

</li>

<li class="cm-nav-list\\\_\\\_item cm-nav-list\\\_\\\_item--item4">

<span class="span1">Label1</span>

<span class="span2">Label2</span>

</li>

<li class="cm-nav-list\\\_\\\_item cm-nav-list\\\_\\\_item--item5">

<span class="span1">Label1</span>

<span class="span2">Label2</span>

</li>

<li class="cm-nav-list\\\_\\\_item cm-nav-list\\\_\\\_item--item6">

<span class="span1">Label1</span>

<span class="span2">Label2</span>

</li>

</ul>

//JS

function selectSquare() {

var me = $(this);

meIndex = me.index();

var selectedItem = me.eq(meIndex);

console.log(selectedItem);

selectedItem.addClass("is-active");

}

function init() {

var label = $(".cm-nav-list__item");

label.click(selectSquare);

}

$(document).ready(init);

Author
Account Strength
80%
Account Age
6 years
Verified Email
Yes
Verified Flair
No
Total Karma
251
Link Karma
97
Comment Karma
154
Profile updated: 6 days ago
Posts updated: 2 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
5 years ago