javascript - Bind jQuery Keypress() to Polymer paper-input -


I am using the framework for the site on which I am working, I want to bind keypress () a polymer & lt; Paper-input & gt; I

HTML

  & lt; Paper input id = "whatever" label = "example" & gt; & Lt; / Paper-input & gt;  

JavaScript

  $ ("#Joe"). Keypress (function () {console.log ("this has worked!");});  

I am aware of the fact that polymers use shadow DOM elements, and therefore & lt; Input & gt; tag is the actual & lt; Paper-input & gt; tag.

One way would be to do something like $ ("# whatever"). Children () and somehow filter for a & lt; Input & gt; tag, but I think it is not the best practice for polymers.

Either way, there is no need to force me to input keyboard input.

It's been a while, but I had the same problem with the web component examiner. It has been found that polymer is now a clean component iron-testing-assistants, in which a script is mock-interactive. JS

Use the key event like:

Javascript

  Mock interface.quistion (polymer.dom (myEl. Root) .Some selectors ('# filter-input'), 'keypress', 13);  


Comments

Popular posts from this blog

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -