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

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -