【问题标题】:Text Box Change Event文本框更改事件
【发布时间】:2014-01-26 01:15:49
【问题描述】:

在浏览器自动更新用户名的情况下,我需要文本框更改事件,密码将自动在密码字段中更新。那时水印应该隐藏。所以那个时候我需要调用文本框更改事件。我尝试了以下事件 聚焦 聚焦 模糊 改变 键位 按键 按键

【问题讨论】:

标签: jquery


【解决方案1】:

文本框更改事件示例

Syntax

$(selector).change(function)

e.g.

$(“txtbox”).change(function)

像这样

    <html>

<head>

<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>

<script>

$(document).ready(function(){

    $("#txtchange").change(function(){

        alert ("change event occured with value: " + document.getElementById("txtchange").value);

  });

});

</script>

</head>

<body>

<p>Enter some text in first field then either press Tab key or click somewhere else on page!</p>

<form id="changeform">

Enter text: <input id="txtchange" value="" type="text">

text field 2: <input id="txtchange2" type="text">

<input type="submit" value="submit now"/>

</form>

</body>

</html>

【讨论】:

    猜你喜欢
    • 2016-02-09
    • 1970-01-01
    • 1970-01-01
    • 2010-11-01
    • 1970-01-01
    • 2015-06-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多