larry*wei 2010-11-03 15:07 采纳率: 50%
浏览 879
已采纳

获取输入文本框中的值

What are the ways to get and render an input value using jQuery?

Here is one:

<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.3.min.js" ></script>
<script type="text/javascript">
    $(document).ready(function(){
        $("#txt_name").keyup(function(){
            alert($(this).val());
        });
    })
</script>

<input type="text" id="txt_name"  />

转载于:https://stackoverflow.com/questions/4088467/get-the-value-in-an-input-text-box

  • 写回答

8条回答 默认 最新

  • MAO-EYE 2013-04-09 13:28
    关注
    //Get
    var bla = $('#txt_name').val();
    
    //Set
    $('#txt_name').val(bla);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(7条)

报告相同问题?