开发者

Jquery change value on input

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
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜