jquery XML .html() instead of .text() is not displaying?
        Posted  
        
            by Xtian
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Xtian
        
        
        
        Published on 2010-06-14T22:40:50Z
        Indexed on 
            2010/06/14
            22:42 UTC
        
        
        Read the original article
        Hit count: 271
        
I can't seem to figure out this problem. I am trying to get xml to render html tags. The problem I am having using .text() will display but not recognize any html tags. If I use .html() or just call var long2 = $(this).find('long'); nothing will show up in Safari or IE.
I have xml paragraph I have text in here that needs bold tags or tags which is why i need html tags in the xml to be recognized.
Code:
$(document).ready(function(){
        $.ajax({
            type: "GET",
            url: "xml/sites.xml",
            dataType: "xml",
            success: function(xml) {
                $(xml).find('site').each(function(){
                    var id = $(this).attr('id');
                    var title = $(this).find('title').text();
                    var Class = $(this).find('class').text();
                    $('<div class="'+Class+'" id="link_'+id+'"></div>').html('<p class="title">'+title+'</p>').appendTo('#page-wrap');
                    $(this).find('desc').each(function(){
                        var url = $(this).find('url').text();
                        var long = $(this).find('long').text();
                        $('<div class="long"></div>').html(long).appendTo('#link_'+id);
                        $('#link_'+id).append('<a href="http://'+url+'">'+url+'</a>');
                             var long2  = $(this).find('long');
                             $('<div class="long2"></div>').html(long2).appendTo('#link_'+id);
                    });
                });
            }
        });
© Stack Overflow or respective owner