I\'m trying to set the value of the hidden field below using jQuery.
I\'m using
$('input[name="testing"]').val(theValue);
Suppose you have a hidden input, named XXX, if you want to assign a value to the following
<script type="text/javascript">
$(document).ready(function(){
$('#XXX').val('any value');
})
</script>
You should use val
instead of value
.
<script type="text/javascript" language="javascript">
$(document).ready(function () {
$('input[name="testing"]').val('Work!');
});
</script>
To make it with jquery, make this way:
var test = $("input[name=testing]:hidden");
test.val('work!');
Or
var test = $("input[name=testing]:hidden").val('work!');
See working in this fiddle.
var test = $('input[name="testing"]:hidden');
test.val('work!');
This worked for me:
$('input[name="sort_order"]').attr('value','XXX');