Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery change value on input

Tags:

jquery

Hi have an hidden input into an display:none div . I need to 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??

like image 230
Ste Avatar asked May 18 '11 07:05

Ste


1 Answers

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>
like image 72
Rory McCrossan Avatar answered Oct 06 '22 16:10

Rory McCrossan