Set value of hidden input with jquery

I'm trying to set the value of the hidden field below using jQuery.

<input type="hidden" value="" name="testing" />

I'm using this code:

var test = $("input[name=testing]:hidden");
test.value = 'work!';

But its not working. What's wrong with my code?


You should use val instead of value.

<script type="text/javascript" language="javascript">
$(document).ready(function () { 
    $('input[name="testing"]').val('Work!');
});
</script>

This worked for me:

$('input[name="sort_order"]').attr('value','XXX');

$('input[name="testing"]').val(theValue);