Detecting value change of input[type=text] in jQuery

前端 未结 10 918
囚心锁ツ
囚心锁ツ 2020-12-04 07:04

I want to execute a function every time the value of a specific input box changes. It almost works with $(\'input\').keyup(function), but nothing happe

10条回答
  •  暖寄归人
    2020-12-04 07:41

    Try this:

    Basically, just account for each event:

    Html:

    
    

    Jquery:

    $("#textbox").keyup(function() { 
        alert($(this).val());  
    }); 
    
    $("#textbox").change(function() { 
    alert($(this).val());  
    }); 
    

提交回复
热议问题