Hi, I am a newby to jquery, and am strugeling with an issue.
In my code below, I get information from an php page which is returning xml. I am making links in a <ol><li> of what the php page return. But I want to catch the call from the a href I make when the user clicks on the link. How can I do this? This is my code: $(document).ready(function() { var box1 = null; var box2 = null; var box3 = null; // add markup to container and apply click handlers to anchors $("#fabricatorSearchName a").click(function(e){ // stop normal link click e.preventDefault(); showLoaderBox(); $('#searchDivSelector').slideDown('fast') ; $.ajax({ type: "GET", url: "ajax/dropBox1.php", data: "box=1", dataType: "xml", success: function(xml) { $('#boxContent ol').html(""); $(xml).find('name').each(function(){ $('<li></li>').html($('<a id="boxLink" href="#" onClick="'+$ (this).text()+'"></a>').html($(this).text())).appendTo('#boxContent ol'); }); } }); }); // add markup to container and apply click handlers to anchors $("#modelSearchName a").click(function(e){ // stop normal link click e.preventDefault(); showLoaderBox(); $('#searchDivSelector').slideDown('fast') ; $.ajax({ type: "GET", url: "ajax/dropBox1.php", data: "box=2", dataType: "xml", success: function(xml) { $(xml).find('name').each(function(){ $('<li></li>').html($('<a href="#"></a>').html($ (this).text())).appendTo('#boxContent ol'); }); } }); }); // add markup to container and apply click handlers to anchors $("#priceSearchName a").click(function(e){ // stop normal link click e.preventDefault(); showLoaderBox(); $('#searchDivSelector').slideDown('fast') ; $.ajax({ type: "GET", url: "ajax/dropBox1.php", data: "box=2", dataType: "xml", success: function(xml) { $(xml).find('name').each(function(){ $('<li></li>').html($(this).text()).appendTo('#boxContent ol'); }); } }); }); $("#boxLink a").click(function(){ alert("Hello world!" + this.href); }); function showLoaderBox() { $('#boxContent ol').html("<center><img src='v1/images/loader.gif' border='0' alt='Loading...'></center>"); } function showLoaderMain() { $('#mainObjects').html("<center><img src='v1/images/loader.gif' border='0' alt='Loading...'></center>"); } function updateObjectList(div) { alert("Hello worlds!"); } }); Best regards, Paul Peelen