paste事件,只能paste数字

1 //getClipboardText

2 EventUtil.addHandler(textbox, "paste", function(event) {

3     event = EventUtil.getEvent(event);

4     var text = EventUtil.getClipboardText(event);

5 

6     if (!/^\d*$/.test(text)) {

7         EventUtil.preventDefault(event);

8     }

9 });

你可能感兴趣的:(paste)