In jQuery to set a hidden field value, we use . val() method. The jQuery . val() method is used to get or set the values of form elements such as input, select, textarea.
in jquery: $('#hiddenfieldid'). val(''); $('#Projectid').
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);
Suppose you have a hidden input with id XXX, if you want to assign a value to the following
<script type="text/javascript">
$(document).ready(function(){
$('#XXX').val('any value');
})
</script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With