Hello all,
I'm trying to create an <ol>
element with jQuery and set its class and id attributes. Is there any way to do this all at once? None of my ideas have worked so far, I'm still very new to jQuery...
views:
118answers:
1
+3
A:
There are at least a couple of different ways to do this:
$('<input id="something" class="something-else" type="text" />')
.appendTo('#someSelector');
or
$('<input type="text" />').attr('id','something')
.addClass('something-else')
.appendTo('#someSelector');
tvanfosson
2009-10-10 02:08:24
Thanks man, worked perfect!
danwoods
2009-10-10 02:40:29