Hello folks,

Despite my best efforts to understand previous posts about multiple firings of functions, I'm still having difficulty with a section of code that persists in firing twice.

When a particular section of a page is loaded, a function is triggered which completes an ajax call to load a list of radio buttons of the structure...

<a href='#' class='ltype' id='1*1'><input type='radio' id='A' name='iLinkTypeID' value='1' /><label for='A'>Standard link</label></a> <a href='#' class='ltype' id='2*4'><input type='radio' name='iLinkTypeID' id='B' value='4' /><label for='B'>non-transaction</label></a>
...etc

This function also contains the code...
$("a.ltype").click(function(){linkType(this.id);});

When one of the list items is clicked, a set of input elements appropriate to the item appear as per function linkType...

function linkType(ej) {
    temp=ej.split('*');
    var ei = temp[1];
    $.log(ei);
    $("#sNewNodeTitle,#sLinkText").val('');
    $("#newlinks,#data1,#data2,#data3).hide();
    $("#iLTG").val(ei);
    switch(ei) {
    case "1":
        $("#newlinks,#data1,#data2").show();
        break;
    case "2":
        $("#newlinks,#data1").show();
        break;
    case "3":
        $("#newlinks,#data1,#data3").show();
        break;
    default:
        alert("An unexpected error has occurred!");
    }
    return false;
};

From the evidence of the console log, this function fires twice each time a list item is clicked.

Is there sufficient info here for someone to explain why this is occuring?

Thanks,

Bruce 
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to