开发者

How to monitor window selection change event in javascript

Is there any method to monitor the c开发者_如何学运维hange event of window.selection?

Something like a callback, to be invoked when user select different content.


If you're using jQuery, and you want to handle select on a specific item with an ID of myInput, you can do this:

$("#myInput").select(function() { alert("Something was selected!"); });

Otherwise, I think you'd need to add it in HTML, like this:

<input type="text" onSelect="alert('foo');" value="default text">


Try the onSelect handler.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜