SOLVED from comment.I have the following jquery code : \[code\]function InitVoteContainer(voteContainer) { var _userVote = voteContainer.children(".storeUserVote").val(); var _userObjectId = voteContainer.children(".storeObjectId").val(); var _userVoteKey = voteContainer.children(".storeVoteKey").val(); var _UserAuth = voteContainer.children(".storeUserAuth").val(); var _voteButtonUp = voteContainer.children("div[pid='btUp']"); var _voteButtonDown = voteContainer.children("div[pid='btDown']"); var upBtValue = http://stackoverflow.com/questions/14086480/0; var downBtValue = 0; _voteButtonUp.attr("class", "upVote_inactive"); _voteButtonDown.attr("class", "downVote_inactive"); _voteButtonUp.prop("onclick", null); _voteButtonDown.prop("onclick", null);}\[/code\]The code will switch class on the upVote and downVote buttons. The code runs fine but the classes is never set? the question is why??Edit 1: Updates with some more code : This jquery code runnes at dodument ready\[code\]function InitVoteControls() {$("#mainPostList").find(".voteCon").each(function () { InitVoteContainer($(this));});}\[/code\]And this is the HTML that the jquery is using :\[code\]<ul id="mainPostList" class="verticalList"> @foreach (var postViewModel in Model.Posts) { <li><div class="postContainer"><div class="voteCon"> <input class="storeUserVote" type="hidden" value="http://stackoverflow.com/questions/14086480/@Model.UserVote" /> <input class="storeObjectId" type="hidden" value="http://stackoverflow.com/questions/14086480/@Model.ObjectId" /> <input class="storeVoteKey" type="hidden" value="http://stackoverflow.com/questions/14086480/@Model.VoteKey" /> <input class="storeUserAuth" type="hidden" value="http://stackoverflow.com/questions/14086480/@Request.IsAuthenticated" /> @if (!Request.IsAuthenticated) { <div pid="btUpVote" class="upVote"></div> } else { <div pid="btUpVote" class="upVote_inactive"></div> } <br style="clear:both;" /> <div class="voteCountBox"> @Html.Encode(Model.VoteBalance) </div> <br style="clear:both;" /> @if (!Request.IsAuthenticated) { <div pid="btDownVote" class="downVote"></div> } else { <div pid="btDownVote" class="downVote_inactive"></div> }</div></div></li> } </ul>\[/code\]