From c2a61d8d9543fab08efaf6aac100fd11e4d65b90 Mon Sep 17 00:00:00 2001 From: "Steve L. Nyemba" Date: Sun, 11 Jan 2015 20:28:59 -0600 Subject: [PATCH] added functions to framework: append child node, show and hide --- dom.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/dom.js b/dom.js index 4cf7c4e..96cf73f 100644 --- a/dom.js +++ b/dom.js @@ -24,7 +24,8 @@ jx.dom = {} ; * @returns {Boolean} */ jx.dom.exists = function(id){ - return document.getElement(id) != null || document.getElementsByName(id) != null ; + + return document.getElementById(id) != null ; } /** * This function will remove a node given it's identifier @@ -40,7 +41,18 @@ jx.dom.remove = function(id){ item.parentNode.removeChild(item) ; } - +jx.dom.append = function(id,_child){ + _parent = jx.dom.get.instance(id) ; + _parent.appendChild(_child) ; +} +jx.dom.show = function(_id){ + _dom = jx.dom.get.instance(_id) ; + _dom.style.display = null; +} +jx.dom.hide = function(_id){ + _dom = jx.dom.get.instance(_id) ; + _dom.style.display = 'none' ; +} /** * This function allow extraction from an select tag, if mutil selection is enabled an array is returned otherwise a scalar or string * The function also supports accessing a user defined attribute if specified otherwise it will use the default 'value', text can be specified