inputEx Documentation Back to homepage

### inputEx Documentation > DOM functions 0.2.2

## DOM manipulation helper functions

inputEx.cn and inputEx.sn are two useful functions to respectively: create an html node and set node attributes.

They are used all over the place in inputEx, so its a good idea to get familiar with them:

#### inputEx.cn

`static <HTMLElement> inputEx.cn(tag, domAttributes, styleAttributes, innerHTML)`
Helper function to create a DOM node. (wrapps the document.createElement tag and the inputEx.sn functions)
Parameters:

`tag <String>` - The tagName to create (ex: 'div', 'a', ...)

`domAttributes <Object>` optional - see inputEx.sn

`styleAttributes <Object>` optional - see inputEx.sn

`innerHTML <String>` optional - The html string to append into the created element

Returns:

`<HTMLElement>` The created node

#### inputEx.sn

`static inputEx.sn(el, domAttributes, styleAttributes)`
Helper function to set DOM node attributes and style attributes.
Parameters:

`el <HTMLElement>` - The element to set attributes to

`domAttributes <Object>` - An object containing key/value pairs to set as node attributes (ex: {id: 'myElement', className: 'myCssClass', ...})

`styleAttributes <Object>` - Same thing for style attributes. Please use camelCase for style attributes (ex: backgroundColor for 'background-color')

Copyright (c) 2007-2009 Eric Abouaf. All rights reserved.
Generated by JsDoc Toolkit 2.0.0 on Wed, 04 Mar 2009 15:41:32 GMT using neyricjslibs-template.