Javascript event object: Where is the selector -


मेरे बैकबोन व्यू में मेरे पास सेटअप है:

  var SomeView; SomeView = Backbone.View.extend ({initialize: function () {this.render ();}, रेंडर: फ़ंक्शन () {// रेंडर फॉर्म}, इवेंट: {"keydown form.registration input": "checkInput"} , CheckInput: function (e) {console.log (e); // यह काम नहीं करता है, लेकिन मैं ऐसे फ़ंक्शन var attr = e.getAttributeWhichTriggeredEvent; $ (attr) .val (); // validate के लिए खोज रहा हूँ। ..}});   

जैसा कि आप देख रहे हैं, मैं उस घटना के चयनकर्ता को प्राप्त करना चाहूंगा जिसने इस घटना को ट्रिगर किया था, ताकि मैं, उदाहरण के लिए, इनपुट मान का उपयोग कर सकूं।

जैसा कि मैंने क्रोमियम में कन्सोल के माध्यम से देखा, मुझे घटना वस्तु में कुछ (वर्तमान) लक्ष्य विशेषताओं को मिला। दुर्भाग्य से वे कुछ भी शामिल नहीं करते जो मैं तत्व को पहचानने के लिए इस्तेमाल कर सकता हूं लेकिन शायद मैं सिर्फ पर्याप्त नहीं दिखता ..

तो मैं यह कैसे करूँ?

< Div class = "post-text" itemprop = "text">

मुझे लगता है कि आप चाहते हैं ..

  $ (e.target) .val ()    

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -