Populating hidden field in a form via button click?

Populating hidden field in a form via button click?

Hello,

Very new at jquery (actually trying to modify a small app created by a programmer) and trying to figure out what I am missing to populate the value of a hidden field for a form that pops up in a window (modal) via a button click.

Code for the button click:
<script type="text/javascript">$(function() { var message = "149"; $( "#create-user" ).button().click(function() { $("#hidden-input").val(message); $( "#dialog-form" ).dialog( "open" ); });});</script>

When i use the following code below, when I click on the button, the form/window pops up and I have a text field with "149 in it (which I assume is a good thing)
<form method="post" id="myForm">
<input type="text" id="hidden-input" name="hidden-input" >

What I am hoping to do is click on the button and have the following happen:
<form method="post" id="myForm">
<input type="hidden" id="hidden-input" name="hidden-input" value="149">

Unfortunately no luck with it....if I try
<form method="post" id="myForm">
<input type="hidden" id="hidden-input" name="hidden-input" value="">
the value is empty. 

Assume I am missing something obvious?

gully