It is easy to manipulate a form element or query an element's attributes with jQuery. Because jQuery's selector function accepts CSS selectors, you can simply select the form element by ID and chain any jQuery method to it to return or manipulate its value or appearance.
When the Drupal Forms API renders a form, it names elements based on their key in the form array. The following element would be rendered with an ID of #edit-code-name:
$form['code-name'] = array(
'#type' => 'hidden',
'#value' => t('James Bond'),
);
The syntax to select this form element via Javascript with jQuery is:
$('#edit-code-name')
Note that spaces and underscores are filtered into hyphens when rendered, so a form array key of code-name and code_name would be selected per the example above.
So, if you want to use Javascript to display to the user the value of the hidden code name field, you would use the following:
alert($('#edit-code-name').val());