Skip to content

Tag: selection

Excel Add-in: How to create a range?

I am writing an Excel add-in in JavaScript. What I need to do is find the currently selected cell, then create a range object that is 4 columns wide and X rows high, with the selected cell at the top left of the selection. I know how to find the currently selected cell, but I don’t know how to either

Reacting to selection changes in an HTML textarea

How can I get, for an HTML textarea element, called back on all selection changes to the text edited therein? (I am currently using the hack of combining keyup, keypress, and mousemove (for dragging selection endpoint), and maybe more could be added, but this is not exactly elegant.) I can’t find it in HTML documentation or on Stack Overflow. By ‘all

Keep the selection in a textarea

Can I prevent the loss of selection in the “onblur” event? Answer I don’t think that’s a good idea. A user with mouse in his/her hand can click anywhere on the page. If you get him/her back into the textarea, it won’t be following the principles of web accessibility.