Plugins

User login
Can't find a Plugin?

Can't find a Plugin you are looking for? Check out the jQuery Wiki page.

Are you a plugin developer? Please move your plugin over to this site.

Website Bug or Feature Request?

Found a bug on the new jQuery Plugin website? Have a feature request?

Submit it to the jQuery Plugin website issue queue to ensure it is noticed!

Perl CGI.pm-style CGI tag functions


Project:appendDom
Version:1.0.0
Component:User interface
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

I found the following functions very useful:

function htmlTag (tagName, properties, body) {
properties = properties == null ? {} : properties;
if ( properties.constructor.toString().indexOf("Array") > -1
|| typeof properties == 'string') {
return htmlTag(tagName, {}, properties);
}
body = body == null ? [] : body;
properties.tagName = tagName;
if (typeof body == 'string') {
properties.innerHTML = body;
}
else {
properties.childNodes = body;
}
return properties;
}

function span (properties, body) {return htmlTag('span', properties, body)}
function div (properties, body) {return htmlTag('div', properties, body)}
function a (properties, body) {return htmlTag('a', properties, body)}
function li (properties, body) {return htmlTag('li', properties, body)}
function ul (properties, body) {return htmlTag('ul', properties, body)}
function table (properties, body) {return htmlTag('table', properties, body)}
function tr (properties, body) {return htmlTag('tr', properties, body)}
function th (properties, body) {return htmlTag('th', properties, body)}
function td (properties, body) {return htmlTag('td', properties, body)}
function input (properties, body) {return htmlTag('input', properties, body)}
function select (properties, body) {return htmlTag('select', properties, body)}
function option (properties, body) {return htmlTag('option', properties, body)}

Using them, you can create HTML with a minimum of syntactic overhead which made my code much more readable and concise.

I would suggest to add such functions to your module