jquery problem where the returned data from an XML file seems inaccessible
        Posted  
        
            by squeaker
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by squeaker
        
        
        
        Published on 2010-03-26T17:29:30Z
        Indexed on 
            2010/03/26
            17:33 UTC
        
        
        Read the original article
        Hit count: 151
        
jquery-ajax
Hi all,
I'm using an xml file to generate some links which i would like to then be able to click on to populate an input box:
$(xmlResponse).find('types').each(function(){
                        var id = $(this).attr('id');
                        var type = $(this).find('type').text();                     
                        $('<span title=\"'+type+'\" class=\"type\">'+type+'</span>').appendTo('#types');                        
                    });
$('span.type').click(function() {    
        var title = $(this).attr('title');
        $("input[name='type']").val(title);
      });
But for some reason clicking on the liks does not populate the input box. It does work if the span is hard coded into the page for example:
<span title="text to populate" class="type">test</span>
I'm guessing that the XML is not getting loaded into the DOM in the right way (or something like that)
Any Ideas?
© Stack Overflow or respective owner