What I'm trying to do is capture that event, parse the pasted text (in a specific format) and generate the suitable options elements according with the pasted text.
I wonder if you could say me how to capture that event for a drop down list, if it is possible.
Thank you in advance for all your answers.
Any correction of my English will be gratefully accepted.
However, the event is not captured when I paste something neither the Ctrl+v shortcut nor the Paste option on context menu. I have tried to paste the text with the drop down list collapsed, expanded, with options, empty, with multiple selection, with single one, etc.
If the <select> element accept the event, why cannot it be captured? Is it definitely impossible? In this case, why does it accept the event? In what cases it can be used?
Interesting. The w3c says the paste event triggers even on a non-editable element. I agree that doesn't appear to be happening though.
I was thinking to suggest you use a transparent div. However, this example with a div works for me in Chrome and not Safari.
I'm still not clear on what you are trying to accomplish though. Why would a user logically try to paste over a select list?
Joined: Apr 23, 2008
Thank you, Jeanne.
Yes, it is interesting that a non editable element can capture the paste event, and it is more interesting why the browser implementation doesn't follow the specification (well, perhaps because it is a draft).
Anyway, I've convinced myselft that the event paste is not capture by a drop down list, at this moment. Perhaps, in the future, when the specification is released.....
About you question over the reason of being trying to capture the event, it is because my customer wants to be able to paste a formatted list over a drop down list, and this action must provoke that the elements of the pasted list are options of the drop down list element. I cannot use a div over the element because the options must can be selected. At this moment, I'll have to use another element (text field, text area) to capture the paste event with the formatted list and accomplish the required functionality.