clicking text in a word cloud to highlight text on page

not sure if this is the right section
but i have a word tag cloud at the top of the page of frequently appearing words in the database (from an array of words) and im trying to implement a code to make it so when you click some text it highlights all uses of it on the page… not sure how to go about this . need help

im thinking somethign with an onclick but not sure how to start
any ideas?

Check this out… By viewing the source you should be able to do what you want with some minor modifications. If you cannot figure it out let us know.

Give that word a unique class and use:
http://docs.jquery.com/UI/Effects/Highlight

can u elaborate further please

Give the words a unique class.

<span class = 'something'>Word</span>

use the effect I linked.
[php]$(".something").click(function () {
$(this).effect(“highlight”, {});
});[/php]

okay im getting somewhere now… im using an array of strings to make a word cloud ($filterwords)
and im trying to make it so when a word in the word cloud is selected it is highlighted throughout the document
how do i make the array $filterwords a unique class

pardon me im a novice in javascript html stuff, and im learning as i go

[php]foreach($filterwords as $word){
echo “$word”;
}[/php]

did something wrong

i did
[php]
foreach($filterwords as $uword)
{
echo “$uword”;
}

[/php]

[php]
$(".something").click(function ()
{
$(this).effect(“highlight”, {});
}

 ); [/php]

it outputted :
555544333333333222222222222222222222222222222222111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
and why am i echoing in the first forloop?

How am I suppose to know the contents of your array? I guessed.
I’ve given you everything you need to know, try to figure it out on your own, it’s better if you solve it then me feeding you code.

Sponsor our Newsletter | Privacy Policy | Terms of Service