Hello! I need help on this. i created image links by reading an xml
and creating the img and a tags in jquery. how do i put a function in
it? i tried the function below but it doesnt seem to work. These image
links are stored in the div: "thumbs"

Below is the code:

$(function() {
        $("#thumbs a").click(function(event) {
                event.preventDefault();
                alert("Hello world!");
        });

        $.ajax({
                type: "GET",
                url: "thumbs.xml",
                dataType: "xml",
                success: function(xml) {
                $(xml).find('thumb').each(function(){
                        var title_text = $(this).find('title').text();
                        var path_text = $(this).find('path').text();

                        $('<a href=""></a>').html('<img src="'+ path_text +'" 
alt="'+
title_text +'" title="'+ title_text +'">')
                        .appendTo('#thumbs');
                        }); //close each(
                }
        }); //close $.ajax(

}); //close $(

Thank you!!

Reply via email to