From ecba7968c19bb8e30796b3248f3e96ea718d9b74 Mon Sep 17 00:00:00 2001 From: rolux Date: Sat, 14 Apr 2012 11:45:19 +0200 Subject: [PATCH] add val() method to Ox.$ --- source/Ox/js/DOM.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/source/Ox/js/DOM.js b/source/Ox/js/DOM.js index ad8e8b35..f12337ba 100644 --- a/source/Ox/js/DOM.js +++ b/source/Ox/js/DOM.js @@ -146,6 +146,7 @@ Ox.$ = Ox.element = function(val) { }); return this; }, + // FIXME: should be "one" bindOnce: function(events) { var that = this; Ox.forEach(Ox.makeObject(arguments), function(callback, event) { @@ -262,6 +263,16 @@ Ox.$ = Ox.element = function(val) { this[0]['on' + event] = null; 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() { return this[0].offsetWidth; }