How do I access this function:
readURL: function() {
var $input = $(this);
if (this.files && this.files[0]) {
var reader = new FileReader();
reader.onload = function(e) {
$input.next('.input-preview').attr('src', e.target.result).show();
}
reader.readAsDataURL(this.files[0]);
}
$(".ImageInput").change(readURL);
},
With this:
$(".ImageInput").change(readURL);
Before the function header looked like this:
function readURL()
And it worked, but how I access the other declaration.
readURL
is a property of an object (that you aren't showing). So pass the object name:
$(".ImageInput").change(yourObject.readURL);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.