3

I am working with the WP Easy Poll plugin for a site where there people will vote for nominees in different categories. When you use this WP Easy Poll Plugin, you click on the Name of the Nominee and bars animate and show you the number of votes or you have an option to show a percentage of the votes counted. This is done through jquery and PHP.

I want people to be able to vote online but I don't want them to see whose winning until the awards are handed out. So I thought an easy fix would be to use an attribute selector to hide the number of votes but when I do that it hides both the name of the nominee and the votes. I can't just select one - can someone help? I tried everything :(

Here is the selector I tried to use to hide the "20%" next to Dikla Carmel:

div[data-myo-perc="yes"]{display:none;}

<div data-myo-poll-id="334" data-myo-clicked="yes" data-myo-option="0" data-myo-perc="yes" class="myo-poll-votes myo-poll-334 myo-poll-bar" id="myo-poll-334-votes-0" style="cursor: default;">Dikla Carmel 20%</div>

これはうまくいきませんでした。候補者の名前と「20%」の両方が削除されます。私がやりたいのは、アワードショーの翌日まで「20%」を非表示にして、有権者がオンラインで勝者の勝率を確認できるようにすることだけです。名前の属性は id="myo-poll-340-votes-1" なので、名前とパーセンテージを選択する理由がわかりません。私はすべてを試しました。. .

div[data-myo-perc*="yes"]{display:none;} ---> No good
div[data-myo-perc^="yes"]{display:none;} ---> No good
div[data-myo-perc~="yes"]{display:none;} ---> No good
div[data-myo-perc$="yes"]{display:none;} ---> No good

私はクライアントのためにこれをやろうとしていますが、今は混乱し始めており、アイデアが不足しています. 誰でも助けることができますか?私はjsを見ました。そしてcss。ファイルと何もありません。

ここでプラグインのデモを見ることができます --> WP Polling Link Demo

4

1 に答える 1

0

テキストが選択されていない場合、テキストの一部を分離することはできません。ターゲットにする方法が必要です。

ここでjsFiddle

これは、あなたが達成しようとしていることを行います。パーセンテージを効果的に非表示にしながら、名前を表示します。

HTML

<div data-myo-poll-id="334" data-myo-clicked="yes" data-myo-option="0" data-myo-perc="yes" class="myo-poll-votes myo-poll-334 myo-poll-bar" id="myo-poll-334-votes-0" style="cursor: default;">Dikla Carmel<span>20%</span></div>

CSS

div[data-myo-perc="yes"] span {
    display: none;
}
于 2013-10-17T22:18:16.347 に答える