获取输入文本框中的值 [英] Get the value in an input text box
本文介绍了获取输入文本框中的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用 jQuery 获取和呈现输入值的方法有哪些?
What are the ways to get and render an input value using jQuery?
这是一个:
$(document).ready(function() {
$("#txt_name").keyup(function() {
alert($(this).val());
});
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
<input type="text" id="txt_name" />
推荐答案
//Get
var bla = $('#txt_name').val();
//Set
$('#txt_name').val(bla);
这篇关于获取输入文本框中的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文