"Convert JavaScript to jQuery" makes no sense: jQuery is just a JavaScript library. All you can do in your code is replacement of some DOM calls with jQuery shortcuts.
First of all, replace
document.getElementById
with
$(selector)
, pretty much as you did in your first line. For example, the selector for you
id="list2"
will be
"#list2"
, so you can replace the line using this
id
, so the whole second line will be:
myDivObj = $("#list2");
And so on…
And yes, you can also replace your calculations with
childNodes
and
nextSibling
, etc., with jQuery traversing.
Please see:
http://api.jquery.com/category/traversing/[
^].
As I can see, you know enough jQuery to comb it by yourself. If you don't waste time on it like myself — leave it as is; it's already good enough.
—SA