inputMethod
Summary
Gets a value that describes how text is entered.
Property of dom/TextEventdom/TextEvent
Syntax
Note: This property is read-only.
var inputMethod = event.inputMethod;
Return Value
Returns an object of type NumberNumber
The input method used to generate the event. One of the following values -
- TextEvent.DOM_INPUT_METHOD_UNKNOWN = 0
- TextEvent.DOM_INPUT_METHOD_KEYBOARD = 1
- TextEvent.DOM_INPUT_METHOD_PASTE = 2
- TextEvent.DOM_INPUT_METHOD_DROP = 3
- TextEvent.DOM_INPUT_METHOD_IME = 4
- TextEvent.DOM_INPUT_METHOD_OPTION = 5
- TextEvent.DOM_INPUT_METHOD_HANDWRITING = 6
- TextEvent.DOM_INPUT_METHOD_VOICE = 7
- TextEvent.DOM_INPUT_METHOD_MULTIMODAL = 8
- TextEvent.DOM_INPUT_METHOD_SCRIPT = 9
Examples
Display a user friendly value of the inputMethod property of an event.
var description=(event.inputMethod)?getDOMInputMethod(event.inputMethod):'not supported';
function getDOMInputMethod(iInputMethod){
switch (iInputMethod){
case TextEvent.DOM_INPUT_METHOD_UNKNOWN:// 0
return 'Unknown';
case TextEvent.DOM_INPUT_METHOD_KEYBOARD:// 1
return 'Keyboard';
case TextEvent.DOM_INPUT_METHOD_PASTE:// 2
return 'Paste';
case TextEvent.DOM_INPUT_METHOD_DROP:// 3
return 'Drop';
case TextEvent.DOM_INPUT_METHOD_IME:// 4
return 'IME';
case TextEvent.DOM_INPUT_METHOD_OPTION:// 5
return 'Option';
case TextEvent.DOM_INPUT_METHOD_HANDWRITING:// 6
return 'Handwriting';
case TextEvent.DOM_INPUT_METHOD_VOICE://7
return 'Voice';
case TextEvent.DOM_INPUT_METHOD_MULTIMODAL: // 8
return 'MultiModal';
case TextEvent.DOM_INPUT_METHOD_SCRIPT://9
return 'Script';
default:
return 'Unknown';
}
}
Usage
Use to determine if the device that initiated the textinput event is to be 'trusted'.
Notes
Not implemented in Safari or Chromium.
Related specifications
- DOM Level 3 Events (20110531)
- Outdated Working Draft
Attributions
Microsoft Developer Network: [inputMethod Property Article]