var numElements question

var numElements question

I have been developing a web-form for my company, and I really can't get this little piece to work. I am basically trying to take an input field, and have the page read that input (a number between 1 and 28) and then displaying that number of a series of form fields. I have some of the code, and I really just need  some help adding an id to the input field that is interacting with the script.

So here is the code I have...

 <head>
   <script src="jQuery.js" type="text/javascript">
   var numElements = $(#'Num_Selects').val();
      if (numElements.match(/\d{1,3}/)) {
         for (var i = 0; i < numElements; ++i) {
             $(body).append(
                $(<select name="Assignment Type"> <option value="select_asst">=Select One=</option> <option value="select_two">Select Two</option> </select>)
             );
         }
      }
</script>
 </head>
 <body>
<FORM>
<P>Number of Selects: <input type="text" name="Num_Selects"></div></P>
</FORM>
 </body>
 </html>

Any direction here would be greatly appreciated!