Get the value of a textbox during cut event

前端 未结 3 1994
我寻月下人不归
我寻月下人不归 2021-01-18 05:33

I have trapped the cut event (jquery) on a textbox. What I want is to get the text on the textbox during the cut event is triggered.

I\'ve tried accessing the data t

3条回答
  •  半阙折子戏
    2021-01-18 05:52

    Hope I got you right:

    In jQuery you could use something like this to see if a textbox is empty on every user's keyup:

    var txt;
    $('#textbox_ID').live('keyup', function() {
        txt = $(this).val().length;
        if(txt < 1) {
            alert("textbox is empty");
        }
    });
    

    This should work, because everytime the user releases a key and has the textbox focused, it checks if it's empty.

提交回复
热议问题