0

I'm trying to have some jquery change a hidden form value on my page when clicking a button and then do a submit.

<div>
    Save As:<br/>
    <input type="button" value="Draft" onclick="javascript:setStatus('Draft')"/>
    <input type="button" value="Complete" onclick="javascript:setStatus('Complete')"/>              
</div>

and my jquery code:

function setStatus(input) {
    $("#Status").val = input;
    $("#TestSheetForm").submit();
} 

I can see the breakpoint is being hit and the code is running without error, if I use firebug and stop immediately after assigning the hidden input val and run $("#Status).val() the value is set to "" even though it should be either draft or complete.

I also verified that if I run

$("Status").val("Draft")
from the firebug console it successfully changes the value upon running $("#Status").val() again

Is there something I'm missing here, should I be setting it another way?

4

1 回答 1

4

Change

$("#Status").val = input;

to

$("#Status").val(input);
于 2012-04-16T00:49:12.400 回答