Forum:JQuery selecting a class

Hello,

There is a poll on the main page of the Club Penguin Wiki, that is found on the right sdebar. In order to save some space, i wanted to remove the line that says:

"The poll was created at ___ on ___, and so far ___ people voted."

I wanted to use jQuery for adding a "display: none" style for that part. The entire poll is placed on this template, that uses another template as a core.

The idea is that the entire poll is placed inside a class called mainpage-poll, so the line of the poll that i wanted to remove will not be removed in other polls in the wiki. The last div element in an id called ajax-poll-area contains this line, so i tried to select it.

This is the script i used:

However, it does not work. I've never really used jQuery much, so i'm not sure if it's even valid.

If you know how it's possible to apply display: none on this line, please reply.

Penguin-Pal  (talk)  19:12, November 4, 2012 (UTC)

P.S. i apologize if this question is very long.


 * I would recommend not using jQuery for this. JavaScript and jQuery are great for dynamically changing the content of a webpage, but this is purely a stylistic issue, so ideally you should use CSS for this.


 * CSS solution (add to your wiki's MediaWiki:Wikia.css or Common.css):


 * selectors the div that contains the text "The poll was created at ___ on ___, and so far ___ people voted.", prefacing it with  (since, on the main page only, you put the poll inside a container with that class) will make sure it only affects the main page.


 * It works great! Once again, thank you very much! Penguin-Pal   (talk)  20:01, November 4, 2012 (UTC)