xml appending issue - in ie, chrome browsers
Posted
by 3gwebtrain
on Stack Overflow
See other posts from Stack Overflow
or by 3gwebtrain
Published on 2010-06-10T17:51:27Z
Indexed on
2010/06/10
17:52 UTC
Read the original article
Hit count: 267
Xml
Hi, i am using this coding for my xml information to append in to html. As well it works fine. but in the ie7,ie8 as well chrome browser it's not propelry. This code work9ing well with firefox,opera, safari..
i unable to find, what is the mistake i made this.. any one help me please?
$(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 receivedData = 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>');
})
// alert('thisTitle : '+thisTitle+'thisIntro :'+thisIntro);
$(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();
// Append content of 'list' node
$('ul.level'+count).append($(this).children());
});
});
});
})
© Stack Overflow or respective owner