![]() |
Input-field with captured text falsely empties on click
The script captures body-text to a specified input-field by either left-clicking and dragging the mousepointer over or simply performing a double-click on it.
The problem: When text is entered manually into the input-field, it simply disappears when a neighbouring select-element is clicked. Why? Another minor issue is that I would actually prefer to be able to limit the capturable area to a container with an id. Although this code doesn't make use of a framework, I wouldn't mind a solution with JQuery or MooTools. Code:
// Captures highlighted text within the document to a specified input-field. |
1 Attachment(s)
Its behaviour for me is that when you type something and click, the text you typed in the box disappears. Is this the correct behaviour? I apologise, but I don't really understand, I don't think.
|
1 Attachment(s)
Quote:
I modified your sample-file to demonstrate the behaviour I'm getting and what I'm expecting to get. After testing it, the issues should be clearer. |
1 Attachment(s)
Thanks. I think a simple check to see if you actually selected anything should do it, shouldn't it? By adding in the following code, I seem to have fixed it. Although I'm not entirely if this is the correct behaviour:
javascript Code:
|
As for your other problem of only selecting items from a specific DIV, I am unsure. I've never used the
createRange() or getSelection() before. I am sorry, but I hope the other thing worked for you! |
Thanks a lot, Wildhoney. Your fix solves all my issues and so simple it was.
|
| All times are GMT. The time now is 03:58 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0