質問

I have 2 File upload controls, i am using Jquery Filupload plug-ins, can any one explain me how should i check which fileupload to be clicked.

So i need to make condition for which file upload had been clicked.

I have done this way but same time $("#UiLogo").click() is firing, please help me any one.

if ($("#UiLogo").click())
        {
            alert("1 - Called");
            $("#UiLogo").val(data.result.Value);
            $("#ImgUiLogo").css('display', 'block');
            $("#ImgUiLogo").attr("src", JsLogoPath + data.result.Value);
        }
        else if ($("#AdminLogo").click())
        {
            alert("2 - Called");
            $("#AdminLogo").val(data.result.Value);
            $("#ImgAdminLogo").css('display', 'block');
            $("#ImgAdminLogo").attr("src", JsLogoPath + data.result.Value);
        }

Regards

役に立ちましたか?

解決

By calling click() method you are programmatically triggering the click event. Need to change your code to delegate click to call your code.

Example:

$("#UiLogo").click(function() {
    alert("1 - Called");
    $("#UiLogo").val(data.result.Value);
    $("#ImgUiLogo").css('display', 'block');
    $("#ImgUiLogo").attr("src", JsLogoPath + data.result.Value);
});

$("#AdminLogo").click(function() {
    alert("2 - Called");
    $("#AdminLogo").val(data.result.Value);
    $("#ImgAdminLogo").css('display', 'block');
    $("#ImgAdminLogo").attr("src", JsLogoPath + data.result.Value);
});
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top