Mottie / Keyboard

Virtual Keyboard using jQuery ~
http://mottie.github.io/Keyboard/
Other
1.78k stars 723 forks source link

jquery.keyboard.js:2862 Uncaught TypeError: el.createTextRange is not a function #450

Closed akhilclarion closed 8 years ago

akhilclarion commented 8 years ago

Hi Friends,

I am getting error : jquery.keyboard.js:2862 Uncaught TypeError: el.createTextRange is not a function And it appears when alwaysOpen: true Please let me know, what am I doing wrong here ?

        $('.text').keyboard({

        display: {
            'bksp': "  \u2190  ",
            'accept': 'accept',
            'default': 'ABC',
            'meta1': '.?123',
            'meta2': '#+=',
            'panic': 'cancel!'
        },
        usePreview: false,
        layout: 'custom',
        alwaysOpen: true,
        autoAccept: true,
        position: {
            of: '.text',
            my: 'center top',
            at: 'center bottom',
            offset: '-110 10'
        },
        customLayout: {
            'default': [
                '` 1 2 3 4 5 6 7 8 9 0 - ',
                ' q w e r t y u i o p {bksp}',
                'a s d f g h j k l \'',
                '{s} z x c v b n m , . @',
                '{cancel!!} {space} {accept!!}'
            ],
            'shift': [
                '` 1 2 3 4 5 6 7 8 9 0 - ',
                ' Q W E R T Y U I O P {bksp}',
                'A S D F G H J K L \'',
                '{s} Z X C V B N M , . @',
                '{cancel!!} {space} {accept!!}'
            ],
            'meta1': [
                '1 2 3 4 5 6 7 8 9 0 {bksp}',
                '- / : ; ( ) \u20ac & @ {enter}',
                '{meta2} . , ? ! \' " {meta2}',
                '{default} {space} {default} {accept}'
            ],
            'meta2': [
                '[ ] { } # % ^ * + = {bksp}',
                '_ \\ | ~ < > $ \u00a3 \u00a5 {enter}',
                '{meta1} . , ? ! \' " {meta1}',
                '{default} {space} {default} {accept}'
            ]
        }
    });
Mottie commented 8 years ago

Hi @akhilclarion!

If I paste the code into this demo, it does show an error - with jQuery UI position utility - but not the keyboard plugin.

So, please try the following:

  1. Make sure that the most up-to-date keyboard plugin is being used.
  2. The latest version of jQuery UI position utility no longer has an offset option. To change the offset, add the change to the my, of or at options (e.g. "right+10 top-25%").
  3. To set the position of the keyboard when usePreview is false, include an at2 option.

    position: {
     // of: '.text',
     my: 'center top',
     at2: 'center bottom',
     // offset: '-110 10'
    },
  4. The meta and meta2 keysets in the layout are not currently reachable. So in the "default" and "shift" layouts, I added this to the last row

    '{meta1} {cancel!!} {space} {accept!!}'

    and made the space bar smaller with this css

    .ui-keyboard-space {
     width: 12em;
    }
Mottie commented 8 years ago

I'm guessing this issue has been resolved, so I'm going to close it. If you continue to have problems, please feel free to continue the discussion in this thread.