add val() method to Ox.$

This commit is contained in:
rolux 2012-04-14 11:45:19 +02:00
parent 84491f2122
commit ecba7968c1

View file

@ -146,6 +146,7 @@ Ox.$ = Ox.element = function(val) {
}); });
return this; return this;
}, },
// FIXME: should be "one"
bindOnce: function(events) { bindOnce: function(events) {
var that = this; var that = this;
Ox.forEach(Ox.makeObject(arguments), function(callback, event) { Ox.forEach(Ox.makeObject(arguments), function(callback, event) {
@ -262,6 +263,16 @@ Ox.$ = Ox.element = function(val) {
this[0]['on' + event] = null; this[0]['on' + event] = null;
return this; return this;
}, },
val: function() {
var ret;
if (arguments.length == 0) {
return this[0].value;
} else {
this[0].value = arguments[0];
ret = this;
}
return ret;
},
width: function() { width: function() {
return this[0].offsetWidth; return this[0].offsetWidth;
} }