From b4a12f3ba322f097dae9b946e10aa61c31288fbf Mon Sep 17 00:00:00 2001 From: Erik Brakkee Date: Sat, 28 Aug 2010 19:01:02 +0000 Subject: [PATCH] --- .../wamblee/wicket/behavior/wamblee-namespace.js | 4 ++++ .../wamblee/wicket/behavior/wamblee-preselect.js | 13 +++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 wicket/components/src/main/resources/org/wamblee/wicket/behavior/wamblee-namespace.js create mode 100644 wicket/components/src/main/resources/org/wamblee/wicket/behavior/wamblee-preselect.js diff --git a/wicket/components/src/main/resources/org/wamblee/wicket/behavior/wamblee-namespace.js b/wicket/components/src/main/resources/org/wamblee/wicket/behavior/wamblee-namespace.js new file mode 100644 index 00000000..08911fd9 --- /dev/null +++ b/wicket/components/src/main/resources/org/wamblee/wicket/behavior/wamblee-namespace.js @@ -0,0 +1,4 @@ + + +var org = org || {}; +org.wamblee = org.wamblee || {}; \ No newline at end of file diff --git a/wicket/components/src/main/resources/org/wamblee/wicket/behavior/wamblee-preselect.js b/wicket/components/src/main/resources/org/wamblee/wicket/behavior/wamblee-preselect.js new file mode 100644 index 00000000..c2caa7b8 --- /dev/null +++ b/wicket/components/src/main/resources/org/wamblee/wicket/behavior/wamblee-preselect.js @@ -0,0 +1,13 @@ +org.wamblee.preselectSetup = function(id) { + var preselect = function(elem) { + if (elem.defaultValue == elem.value) { + elem.select(); + } + }; + // Add focus listeners. + $(id).find(":text, textarea").each(function() { + $(this).focus(function() { + preselect(this); + }); + }) +} \ No newline at end of file -- 2.31.1