The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Div Class Specific - jQuery

Go down

Solved Div Class Specific - jQuery

Post by iProtiige July 9th 2012, 3:27 pm

I was following a tutorial for changing a post background dependent on forum rank.

Code:
$(function() {
$('div.post:has(".specialpost"), div.postmain:has(".specialpost")').css('background-color','#000');
});

However, this code changes the entire post background. I tried changing it to the specific class 'posthead'.

Code:
$(function() { 
$('div.post:has(".owner"), div.postmain:has(".owner")')$('div.posthead').css('background-color','#3e5591'); 
});

Yet this doesn't seem to work at all (I'm most likely doing something wrong). The code works fine when the $('div.posthead') is removed but affects the wrong areas.

Any help is appreciated!


Last edited by iProtiige on July 9th 2012, 3:50 pm; edited 1 time in total
avatar
iProtiige
New Member

Posts : 2
Reputation : 1
Language : English

Back to top Go down

Solved Re: Div Class Specific - jQuery

Post by iProtiige July 9th 2012, 3:49 pm

Turns out I just solved it! Very Happy

Since div.posthead had the {postrow.displayed.POSTER_RANK_NEW} on it I was able to change the code to have it find the rank off of the posthead rather than the entire post.

Code:
$(function() { 
$('div.head:has(".owner"), div.posthead:has(".owner")').css('background-color','#3e5591'); 
});

Solved
avatar
iProtiige
New Member

Posts : 2
Reputation : 1
Language : English

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum