How to access the value of an element detected by livequery
<p>I am using $_SESSION to pass back a value in the event of page redirect.</p>

<p>As jquery cannot access $_SESSION I decided to use PHP to output the value to a hidden div and remove that div once the value had been picked up. I expect that there is a neater way to do this but I don't know how else to expose the $_SESSION variable to jquery.</p>

<pre><code>&lt;?php       
    $pass_Back = $session-&gt;get_Pass_Back();
    $session-&gt;clear_Pass_Back();
?&gt;

&lt;?php
    if (count($pass_Back) != 0){
        echo "&lt;input class=\"field_Input_Left\" id=\"schedule_Description\" type=\"text\" name=\"schedule_Description\" value=\"" . array_shift($pass_Back) . "\"/&gt;&lt;br /&gt;";
        echo "&lt;div id=\"pass_Back\" style=\"visibilty: hidden;\" &gt;&lt;/div&gt;";
    } else {    
        echo "&lt;input class=\"field_Input_Left\" id=\"schedule_Description\" type=\"text\" name=\"schedule_Description\"/&gt;&lt;br /&gt;";
    }
?&gt;
</code></pre>

<p>Once this was done I needed a method to let jquery know if and when this new element was added to the DOM. Hence I used the plugin livequery to match when the element added. This it does which is great.</p>

<p>But when I try to access the value in the div it states that it is undefined. </p>

<pre><code>$("#pass_Back").livequery(function(){
    if ($("#class_Name").val() != 0){
        var class_Name = $("#class_Name").val();
        get_Schedule_Data(class_Name);
    } else {
        var class_Name = "ALL";
        get_Schedule_Data(class_Name);
    }   


    $value = $(this).attr("value");
    auto_Fill_Schedule($("#pass_Back").attr("value"));

    // destroy pass back

    $("#pass_Back").remove();
});
</code></pre>

<p>When reviewed in firebug I note that at the point that livequery finds the added element no html is displayed. The DOM is ready otherwise the livequery couldn't have functioned but is this why no value is found?</p>

<p>Any guideance gratefully received.</p>
