jquery Append Issue
Posted
by 3gwebtrain
on Stack Overflow
See other posts from Stack Overflow
or by 3gwebtrain
Published on 2010-05-29T18:46:53Z
Indexed on
2010/05/29
18:52 UTC
Read the original article
Hit count: 352
I am getting the append issue with this code. In my xml i go 2 no. of "listgroup" and jquery print propelry. but within the earch "listgroup", first group contain 6 points and second group contain 6 point. these 2 section has to print separately to 'ul' element.
But my problem is first time while it print itself both 12points in first ul i am getting and it print 6 pint to second ul propelry..
what i want is, first ul has to have 6 points and second has6 point what it has in the xml tree...
$(function(){
$.get('career-utility.xml',function(myData){
$(myData).find('listgroup').each(function(index){
var listGroup = $(this);
var listGroupTitle = $(this).attr('title');
var shortNote = $(this).attr('shortnote');
var subLink = $(this).find('sublist');
var firstList = $(this).find('list');
$('.grouplist').append('<div class="list-group"><h3>'+listGroupTitle+'</h3><ul class="level">'+index+'</ul></div>');
$(this).children().each(function(num){
var text = $(this).text();
$('<li>'+text+'</li>').appendTo('ul.level');
})
})
})
})
© Stack Overflow or respective owner