$(function(){/** * a、当前对象属性改变,并且是由键盘或鼠标事件激发的(脚本触发无效) * b、当前对象失去焦点(onblur) */ $("#change").change(function(){ console.log("change="+$(this).val()); });
/** * a、keypress/keydown/keyup监听键盘事件,鼠标复制黏贴操作无效 */ $("#keypress").keypress(function(){ console.log("keypress="+$(this).val()); });
/** * a、input是标准的浏览器事件,一般应用于input元素,当input的value发生变化就会发生,无论是键盘输入还是鼠标黏贴的改变都能及时监听到变化 * b、propertychange,只要当前对象属性发生改变。 */
$(".center").delegate(".center_comment" ,"input propertychange " ,function(){ console.log ($(this).val()) })
}); </script></html>
转载于:https://www.cnblogs.com/Young-shi/p/11121672.html
相关资源:JAVA上百实例源码以及开源项目