SOLUTION:
Because the PHP was in an iterative loop, I needed to have the script tags
for the jQuery within the loop as well so that PHP ID reference would have a
value.  When the script tag was outside of the loop, no value was being
returned by the PHP.

-MP

 

propstm wrote:
> 
> **My apologies for resending but I botched the formatting horribly.<br />
> In a simple world the function i'm trying to perform is:<br /><br />
> 
>   <code>$(document).ready(function(){<br />
>     $("button").click(function () {<br />
>       $('.cars>#seats').slideToggle("slow");<br />
>     });<br />
>   });</code><br /><br />
> 
> But I'm working in Wordpress.  What I'm trying to do is for each entry be
> able to toggle the main content of the entry to either a hidden of visible
> state.  When a person clicks a button which is placed within the post next
> to the title text, the visible state of the main content is toggled. 
> Using the simple example I can easily toggle static content, but I believe
> my issue to lie in the fact that the post ID is derived from PHP.  How do
> I solve the issue?<br />
> <br />
> I've tried:<br /><br />
> 
> <code>  $(document).ready(function(){<br />
>     $("#post-\\<\\?php the\\_ID\\(\\)\\; \\?\\>>button").click(function ()
> {<br />
>       $('#post-\\<\\?php the\\_ID\\(\\)\\;
> \\?\\>>.content').slideToggle("slow");<br />
>     });<br />
>   });  </code><br /><br />
> *Which i thought to use after checking the jQuery FAQ
> and also tried:<br /><br />
> <code>  $(document).ready(function(){<br />
>     $("post-<?php the_ID(); ?>>button").click(function () {<br />
>       $('#post-<?php the_ID(); ?>>.content').slideToggle("slow");<br />
>     });<br />
>   });</code><br /><br />
> 
> Neither worked.  Please help me out!
> Thanks in advance
> -MP
> 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-do-I-reference-PHP-for-an-ID-value--tp20573038s27240p20574394.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to