views:

23

answers:

1

I am pulling info from an XML file and the div class="long" works great but the anchor doesn't work or doesn't show up in IE. It works in all other browsers but NOT IE? any thoughts?

$(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);
    $('<a href="http://'+url+'"&lt;/a&gt;').html(url).appendTo('#link_'+id);
});
+1  A: 

$('<a href="http://'+url+'"&gt;&lt;/a&gt;').html(url).appendTo('#link_'+id); ?

You left the closing bracket of your a tag open.

Aaron Harun
I wish that was it.. i have it closed further down in my code.
Xtian
Did you try doing it in one step: `$('#link_'+id).append('<a href="http://'+url+'">'+url+'</a>');`What version of IE are you using?
Aaron Harun
@Xtian - Can you clarify? You can't be closing it further down in your code, that's a node/document fragment creation, you need to create a value node at that point.
Nick Craver
Aaron, doing it in one step worked! I am using IE 7 and it shows up using your code. Thanks
Xtian
You're welcome, on a (slightly self-serving) side note, as @matt suggested, you should accept answers if they are correct.
Aaron Harun