wotney
wotney

Reputation: 1046

Using Jquery to capture click event of <asp:FileUpload> control

My code:

<script>
    $('.Upload').on("click", function () {
        alert("Click event found using class as identifier");
    });

    $('#FileUpload1').on("click", function () {
        alert("Click event found using ID as identifier");
    });
</script>

<asp:FileUpload ID="FileUpload1" runat="server" CssClass="Upload" />

I'm using the latest version of Jquery(1.9) which is why I'm using .on instead of .live

But neither of my alerts fire when I click the 'browse' button.

Can anyone help at all ??

Thanks.

Upvotes: 0

Views: 1092

Answers (1)

A. Wolff
A. Wolff

Reputation: 74420

You must use delegation with .on() synthax, see equivalent to live():

$(document).on("click",".Upload",function(){...});

Upvotes: 4

Related Questions