Hi,

"id" is designed to work with only 1 instance in a web page.
If you need multiple instances of an element, use class="newsTrigger"
instead of id="newsTrigger".
And change $('#newsTrigger') into $('.newsTrigger').

Regards,
Irwan Setiawan


-----Original Message-----
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of TrixJo
Sent: Monday, August 24, 2009 9:54 AM
To: jQuery (English)
Subject: [jQuery] Trying to pass vars from multiple triggers


Hi I have multiple triggers and I am trying to pass variables via a
"rel=" tag (which are unique id's) for each trigger

I can get most of it working, problem is that since there are multiple
triggers with id="newsTrigger" only the first listed trigger works

Using PHP/mySQL.



An example trigger is:
while loop{
   echo '<span id="newsTrigger" style="font-size:0.8em;" rel="'.
$rowNewsid[$counter].'"><a href="'.$rowNewsPermalink
[$counter].'">'.substr($rowNewsHeadline[$counter],0,40).'</a></span>';
}

The above outputs a large number of rows with the same span id of
"newsTrigger".  When a user mousesover any of the newsTrigges I am
trying to get an ajax dialog to load up content based on the id that
is being passed through the rel tag.  How do I do this?


The javascript so far is:


<script>
$(document).ready(function(){

        $("#newsTrigger").mouseover(function() {
                var newsid = $(this).attr("rel");
                alert(newsid);

        });

});

</script>


Reply via email to