Javascript returning undefined
<p>I am trying to get the value of a spinner and display its value. Here is the spinner code:</p>

<pre><code>&lt;div id="site_content"&gt;
    &lt;div id="content"&gt;
        &lt;h:body&gt;
            &lt;h:form&gt;
                &lt;div class="whiteSpace" /&gt;
                &lt;p:spinner id="minutes" min="0" max="1000" value="#{printerSettings.t}" size="1"&gt;
                    &lt;p:ajax update="NewTime" /&gt;
                    &lt;f:validateLongRange minimum="1" maximum="1000" /&gt;
                &lt;/p:spinner&gt;
                &lt;h:message id="minutes2" for="minutes" style="color:red" /&gt;
</code></pre>

<p>and here is the javascript code that is called, when the user presses submit</p>

<pre><code>function Thankyou() {
    var minuteVal = $('minutes').val(); //not finding the minutes selected
    alert(minuteVal);
    alert("Sent to the printing holding queue, you may close this app now or carry on using this app, your work will still print out ");
    //location.href = 'index.xhtml';
}
</code></pre>

<p>I have tried</p>

<pre><code>var minuteVal = $('minutes').text();
</code></pre>

<p>and this returns an empty box. Thanks.</p>

<p><strong>Edit</strong> </p>

<p>The JavaScript above is found </p>

<pre><code>                &lt;/h:form&gt;
            &lt;/h:body&gt;
        &lt;/div&gt;
    &lt;/div&gt;
    &lt;script type="text/javascript"&gt;
        .....
    &lt;/script&gt;
&lt;/html&gt;
</code></pre>

<p>at the bottom of the XHTML.</p>

<p>EDIT</p>

<p>here is the source, i don't have a clue what any of this means </p>

<pre><code>In how many minutes time would you like to have your job sent to the printer ?
&lt;div class="whiteSpace"&gt;&lt;/div&gt;
&lt;span id="j_idt8:minutes" class="ui-spinner ui-widget ui-corner-all"&gt;
    &lt;input id="j_idt8:minutes_input" name="j_idt8:minutes_input" type="text" class="ui-spinner-input ui-inputfield ui-state-default ui-corner-all" autocomplete="off" value="1" size="1" /&gt;
    &lt;a class="ui-spinner-button ui-spinner-up ui-corner-tr ui-button ui-widget ui-state-default ui-button-text-only"&gt;
        &lt;span class="ui-button-text"&gt;
            &lt;span class="ui-icon ui-icon-triangle-1-n"&gt;&lt;/span&gt;
        &lt;/span&gt;
    &lt;/a&gt;
    &lt;a class="ui-spinner-button ui-spinner-down ui-corner-br ui-button ui-widget ui-state-default ui-button-text-only"&gt;
        &lt;span class="ui-button-text"&gt;
            &lt;span class="ui-icon ui-icon-triangle-1-s"&gt;&lt;/span&gt;
        &lt;/span&gt;
    &lt;/a&gt;
&lt;/span&gt;
&lt;script id="j_idt8:minutes_s" type="text/javascript"&gt;
    PrimeFaces.cw('Spinner', 'widget_j_idt8_minutes', {
        id: 'j_idt8:minutes',
        step: 1.0,
        min: 0.0,
        max: 1000.0,
        behaviors: {
            change: function(event) {
                PrimeFaces.ab({
                    source: 'j_idt8:minutes',
                    event: 'valueChange',
                    process: 'j_idt8:minutes',
                    update: 'j_idt8:NewTime'
                }, arguments[1]);
            }
        }
    });
&lt;/script&gt;
&lt;span id="j_idt8:minutes2"&gt;&lt;/span&gt;
</code></pre>

<p>EDIT</p>

<pre><code>function Thankyou()
{
    var minutesVal = $('#minutes').spinner('value');//not finding the minutes selected
    alert(minutesVal);
    alert("Sent to the printing holding queue, you may close this app now or carry on using this app, your work will still print out ");
    //location.href = 'index.xhtml';
}
</code></pre>

<p>Now nothing happens, the loading symbol on the mouse comes up but no message box etc</p>
