How to get the selected text in textarea using jQuery in Internet Explorer 7?

后端 未结 2 965
天命终不由人
天命终不由人 2020-12-20 00:27

I tried the jquery-fieldselection plugin to get the selected text in textarea.

It works fine in Firefox and Chrome, but not in Internet Explorer 7.

I use the

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-20 00:38

    Here is a very concise and compact jquery plugin that works for IE7,IE8,IE9,FF,Chrome.. Allows you to get/set start & end position of a selection and also replace selected text programmatically. A working example/code version is here: http://jsfiddle.net/hYuzk/3/ A version with more detailed comments etc. is here: http://jsfiddle.net/hYuzk/4/

提交回复
热议问题