##// END OF EJS Templates
Add placeholder attribute to text widgets
Jessica B. Hamrick -
Show More
@@ -141,6 +141,16 define(["widgets/js/widget"], function(WidgetManager){
141 141 .appendTo(this.$el);
142 142 this.$el_to_style = this.$textbox; // Set default element to style
143 143 this.update(); // Set defaults.
144 this.model.on('change:placeholder', function(model, value, options) {
145 this.update_placeholder(value);
146 }, this);
147 },
148
149 update_placeholder: function(value) {
150 if (!value) {
151 value = this.model.get('placeholder');
152 }
153 this.$textbox.attr('placeholder', value);
144 154 },
145 155
146 156 update: function(options){
@@ -23,6 +23,7 class _StringWidget(DOMWidget):
23 23 value = Unicode(help="String value", sync=True)
24 24 disabled = Bool(False, help="Enable or disable user changes", sync=True)
25 25 description = Unicode(help="Description of the value this widget represents", sync=True)
26 placeholder = Unicode("", help="Placeholder text to display when nothing has been typed", sync=True)
26 27
27 28
28 29 class HTMLWidget(_StringWidget):
General Comments 0
You need to be logged in to leave comments. Login now