Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem when using destroy method #358

Closed
jokytam168 opened this issue Jun 10, 2015 · 2 comments
Closed

Problem when using destroy method #358

jokytam168 opened this issue Jun 10, 2015 · 2 comments

Comments

@jokytam168
Copy link

Dear Mottie,
Thank you for your great work, I am very appreciated with this fancy script.

I have a problem, when I call destroy method, I always get from the console

Uncaught TypeError: Cannot read property 'el' of null

What I want is user click open keyboard, and still could key in normally.
Although it still works as I wish, any suggestion to fix? Here is the html & code I use

<form>
<a id="ekeyboard" href="#">show keyboard</a>
<input type="text" id="txtPassword" name="txtPassword">
</form>

<script>
$("#ekeyboard").on('click',function(){
   $('#txtPassword').keyboard({
      beforeClose: function(event, keyboard, el) {
         keyboard.destroy();
      }
   });
   $('#txtPassword').focus();
});
</script>
@Mottie
Copy link
Owner

Mottie commented Jun 10, 2015

Hi @jokytam168!

The issue here is that the destroy method shouldn't be called in the beforeClose callback. Instead destroy the keyboard in the hidden callback.

I did find a problem even when destroying the keyboard in the "hidden" callback, so I'll provide a fix for that in the master branch.

@jokytam168
Copy link
Author

Thank you for your quickly update. All errors fixed!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants