by shaunxcode · 16y ago · 0 comments
function tag(name) {
return $('<' + name +'></' + name + '>');
}
tag('div').append(
tag('ul').append(
tag('li').html('a'),
tag('li').html('b')))
which would become: ['div',
['ul',
['li', 'a'],
['li', 'b']]]
That seems substantially nicer to look at - but lacks the ability to easily add event handlers etc. that I get w/ the jquery approach. There is no reason it could not be inter-operable though: ['div', tag('span').html('click me').click(function(){alert('clicked')})];No comments yet.