How to get textbox value with jQuery

来源:互联网 发布:兄弟连linux视频教程 编辑:程序博客网 时间:2024/05/06 08:58
<html><head><title>jQuery get textbox value example</title> <script type="text/javascript" src="jquery-1.3.2.min.js"></script> </head> <body> <h1>jQuery get textbox value example</h1> <h4>TextBox value : <label id="msg"></label></h4> <div style="padding:16px;">TextBox : <input type="textbox" value="Type something"></input></div> <button id="Get">Get TextBox Value</button> <button id="Set">Set To "ABC"</button> <button id="Reset">Reset It</button> <script type="text/javascript">    $("button:#Get").click(function () { $('#msg').html($('input:textbox').val());     });     $("button:#Reset").click(function () { $('#msg').html("");$('input:textbox').val("");     });     $("button:#Set").click(function () { $('input:textbox').val("ABC");$('#msg').html($('input:textbox').val());     }); </script> </body></html>
=============================