The code is:
<input ID="fileUpload1" runat="server" type="file"
The following works fine:
<input onchange="javascript:alert('hola');" ID="fileUpload1" runat="server" type="file"
I'd like to get this result using jQuery, but that doesn't work:
$('#fileUpload1').change(function (e) {
alert("hola");
});
I am missing something? (Edit: Yes I missed include the *.js file.)
This jsfiddle works fine for me.
Note: .delegate() is the fastest event-binding method for jQuery < 1.7: event-binding methods
Or could be:
To be specific:
$('input[type=file]#fileUpload1').change(...
Try to use this:
HTML:
JavaScript:
It should work fine, are you wrapping the code in a
$(document).ready()
call? If not use that or uselive
i.e.Here is a jsFiddle of this working against jQuery 1.4.4
You can use this one also
Demo : http://jsfiddle.net/NbGBj/