jQuery原⽣JS实时监听input输⼊框值变化input事件:
onchange:
1、要在 input 失去焦点的时候才会触发;
2、在输⼊框内容变化的时候不会触发change,当⿏标在其他地⽅点⼀下才会触发;
3、onchange event 所有主要浏览器都⽀持;
4、onchange 属性可以使⽤于:<input>, <select>, 和 <textarea>。
<script>
function change(){
var ElementById("password");
x.value=UpperCase();
    console.log("出发了")
}
</script>
</head>
<body>
输⼊你的密码: <input type="text" id="password" onchange="change()">
</body>
oninput:
1、在⽤户输⼊时触发,它是在元素值发⽣变化时⽴即触发;
2、该事件在 <input> 或 <textarea> 元素的值发⽣改变时触发。
3、缺陷:从脚本中修改值不会触发事件。从浏览器下拉提⽰框⾥选取值时不会触发。IE9 以下不⽀持,所以IE9以下可⽤onpropertychange 事件代替。
JS: <input type="text" id="password" oninput="change()">
jQuery: $("#password").on('input propertychange', change);
onpropertychange:
1、会实时触发,会在元素的属性改变时就触发事件。当元素disable=true时不会触发
2、缺陷:只在IE 下⽀持,其他浏览器不⽀持,⽤oninput来解决。
<input type="text" id="password" oninput="onpropertychange()">
 jQuery:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>RunJS</title>
<script src="code.jquery/jquery-3.1.1.min.js"></script>
</head>
<body>
<input type="text" id="password" autoComplete='off'>
<script type="text/javascript">
$(function(){
  $('#password').bind('input propertychange', function() {
    console.log('在实时触发')
  $('#result').html($(this).val().length);
    $(this).val().length != 0 ? $("#login").css("background-color", "#086AC1") : $("#login").css("background-color", "#529DE0")
  });
})
</script>
</body>
</html>
 JavaScript;
<script type="text/javascript">
// Firefox, Google Chrome, Opera, Safari, Internet Explorer from version 9
function OnInput (event) {
alert ("The new content: " + event.target.value);
jquery修改html内容
}
// Internet Explorer
function OnPropChanged (event) {
if (LowerCase () == "value") {
alert ("The new content: " + event.srcElement.value);
}
}
</script>
<input type="text" oninput="OnInput (event)" onpropertychange="OnPropChanged (event)" value="Text field" />