xml append issue in ie,chrome
Posted
by 3gwebtrain
on Stack Overflow
See other posts from Stack Overflow
or by 3gwebtrain
Published on 2010-06-11T04:59:06Z
Indexed on
2010/06/11
5:02 UTC
Read the original article
Hit count: 264
appendchild
Hi,
I am creating a html page, using xml data. in which i am using the following function. It works fine with firefox,opera,safari. but in case of ie7,ie8, and chrome the data what i am getting from xml, is not appending properly. any one help me to solve this issue?
in case any special thing need to concentrate on append funcation as well let me know..
$(function(){
var thisPage;
var parentPage;
$('ul.left-navi li a').each(function(){
$('ul.left-navi li a').removeClass('current');
var pathname = (window.location.pathname.match(/[^\/]+$/)[0]);
var currentPage = $(this).attr('href');
var pathArr = new Array();
pathArr = pathname.split(".");
var file = pathArr[pathArr.length - 2];
thisPage = file;
if(currentPage==pathname){
$(this).addClass("active");
}
})
$.get('career-utility.xml',function(myData){
var myXml = $(myData).find(thisPage);
parentPage = thisPage;
var overviewTitle = myXml.find('overview').attr('title');
var description = myXml.find('discription').text();
var mainsublinkTitle = myXml.find('mainsublink').attr('title');
var thisTitle = myXml.find("intro").attr('title');
var thisIntro = myXml.find("introinfo").text();
$('<h3>'+overviewTitle+'</h3>').appendTo('.overViewInfo');
$('<p>'+description+'</p>').appendTo('.overViewInfo');
var sublinks = myXml.find('mainsublink').children('sublink');
$('#intro h3').append(thisTitle);
$('#intro').append(thisIntro);
sublinks.each(function(numsub){
var newSubLink = $(this);
var sublinkPage = $(this).attr('pageto');
var linkInfo = $(this).text();
$('ul.career-link').append('<li><a href="'+sublinkPage+'">'+linkInfo+'</a></li>');
})
$(myXml).find('listgroup').each(function(index){
var count = 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-one level' + count + '"></ul></div>');
firstList.each(function(listnum) {
$(this).wrapInner('<li>')
.find('sublistgroup').wrapInner('<ul>').children().unwrap()
.find('sublist').wrapInner('<li>').children().unwrap();
$('ul.level'+count).append($(this).children());
});
});
});
})
Thanks for advance..
© Stack Overflow or respective owner