Jquery在输入时更改值 [英] Jquery change value on input

查看:65
本文介绍了Jquery在输入时更改值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你有一个显示的隐藏输入:none div。我需要改变隐藏的输入值,但我不能..
我试试这个:

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');

嘿帮忙??

推荐答案

您是否在页面中包含了jQuery库,并将该行更改为正确的位置?

Have you included the jQuery library in your page, and put that line changing the value in the correct place?

这样的事情:

<script type="text/javascript" src="location/of/jquery.js"></script>
<script type="text/javascript">
    $(function() {
        $("#hidden_input").val('test');
    });
</script>

这篇关于Jquery在输入时更改值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆