javascript - How can I clear this text box? -


निम्न मिथ्रिल कोड इसका एक मूल्य खींचकर एक टेक्स्ट बॉक्स को रिक्त करने के लिए है यह पाठ बॉक्स को साफ़ नहीं करता है (या कुछ भी करता है) मैं इसे कैसे काम कर सकता हूं?

ध्यान दें कि यदि मैं इस रेखा को बदलता हूं:

  this.newItemName ("");  

से:

  this.newItemName ("abc");  

फिर पाठ बॉक्स एक नए मान के साथ अद्यतन किया गया है। लेकिन मैं इसे स्पष्ट करना चाहता हूं।

  var ऐप = {नियंत्रक: फ़ंक्शन () {this.newItemName = m.prop (""); This.makeNewItem = फ़ंक्शन (नाम) {यदि (नाम) {this.newItemName (""); }}}, देखें: फ़ंक्शन (ctrl) {वापसी मी ("div", [m ("span", "new item"), मी ("इनपुट", {type: "text", onchange: m.withAttr ( "मान", ctrl.makeNewItem.bind (ctrl)), मान: ctrl.newItemName ()})]); }}; एम। मॉड्यूल (document.body, एप);  

आपका कोड काम करने के लिए प्रतीत होता है:

यह संभव है कि आप मिथ्रिल के एक पुराने संस्करण का उपयोग कर रहे हैं।

ऐसे प्रमाण को संतुष्ट करने के लिए नीचे दिए गए कोड:

  var ऐप = {नियंत्रक: फ़ंक्शन () {this.newItemName = m.prop ( ""); This.makeNewItem = फ़ंक्शन (नाम) {यदि (नाम) {this.newItemName (""); }}; }, देखें: फ़ंक्शन (ctrl) {वापसी मी ("div", [m ("span", "new item"), मी ("इनपुट", {type: "text", onchange: m.withAttr ("value ", Ctrl.makeNewItem.bind (ctrl)), मान: ctrl.newItemName ()}))); }}; एम। मॉड्यूल (document.body, एप);  

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

c# - Chart control: Design messed Up after clearing and re-adding Y-Values -

ruby on rails - Apipie interferes with proper error codes -