Hi have an hidden input into an display:none div . I need to开发者_Go百科 chenge the value of my input hidden but i can't.. I try this:
<div style='display:none'>
<input id='hidden_input' name='xxx' type='hidden' value='' />
</div>
$("#hidden_input").val('test');
Hey help??
Have you included the jQuery library in your page, and put that line changing the value in the correct place?
Something like this:
<script type="text/javascript" src="location/of/jquery.js"></script>
<script type="text/javascript">
$(function() {
$("#hidden_input").val('test');
});
</script>
see this, could help you http://jsfiddle.net/g2fsQ/
The code you wrote should work. You also may have forgotten this bit of code :
$(document).ready(function(){
// your code here
});
精彩评论