ui.Textbox.onChange
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
רושם קריאה חוזרת שמופעלת כשיש שינוי בטקסט בתיבת הטקסט.
באופן ספציפי, המערכת קוראת לפונקציית הקריאה החוזרת במקרים הבאים:
– המשתמש מקליד ערך חדש ואז תיבת הטקסט מאבדת את המיקוד או שהמשתמש לוחץ על Enter.
– ערך חדש מוגדר באופן פרוגרמטי באמצעות set('value', newValue).
מחזירה מזהה שאפשר להעביר אל unlisten() כדי לבטל את הרישום של הקריאה החוזרת.
שימוש | החזרות |
---|
Textbox.onChange(callback) | מחרוזת |
ארגומנט | סוג | פרטים |
---|
זה: ui.textbox | ui.Textbox | המופע ui.Textbox. |
callback | פונקציה | הקריאה החוזרת שמופעלת כשהטקסט משתנה. הקריאה החוזרת מקבלת את הטקסט שמופיע כרגע בתיבת הטקסט ואת הווידג'ט של תיבת הטקסט. |
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-26 (שעון UTC).
[null,null,["עדכון אחרון: 2025-07-26 (שעון UTC)."],[[["\u003cp\u003eTriggers a function when the textbox content is modified, either by user input or programmatically.\u003c/p\u003e\n"],["\u003cp\u003eThe registered function receives the current text and the textbox widget as arguments.\u003c/p\u003e\n"],["\u003cp\u003eProvides a method to unregister the function using a unique ID returned during registration.\u003c/p\u003e\n"],["\u003cp\u003eText change is triggered by user input (typing followed by focus loss or pressing Enter), or by programmatically setting a new value.\u003c/p\u003e\n"]]],[],null,["# ui.Textbox.onChange\n\n\u003cbr /\u003e\n\nRegisters a callback that's called when text in the textbox changes.\n\n\u003cbr /\u003e\n\nIn particular, the callback is called when:\n\n- The user types a new value and then either the textbox loses focus or the user presses enter.\n\n- A new value is set programmatically with set('value', newValue).\n\nReturns an ID which can be passed to unlisten() to unregister the callback.\n\n| Usage | Returns |\n|------------------------------|---------|\n| Textbox.onChange`(callback)` | String |\n\n| Argument | Type | Details |\n|--------------------|------------|------------------------------------------------------------------------------------------------------------------------------|\n| this: `ui.textbox` | ui.Textbox | The ui.Textbox instance. |\n| `callback` | Function | The callback to fire when the text changes. The callback is passed the text currently in the textbox and the textbox widget. |"]]