Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I call a JavaScript function after selecting a file from the Select File window and closing it?

I have a file input element

<input type="file" id="fileid"> 

How do I call a JavaScript function after selecting a file from the dialog window and closing it?

like image 650
coderex Avatar asked May 10 '10 19:05

coderex


People also ask

How do you call a JavaScript function from a file?

The first method is to call the JavaScript function in HTML. For this, you have to create a function then define this function either in the head section or body section of the HTML document. You can either create a link or a button and then an onclick() event is associated with them in order to call this function.

What are the different ways to invoke a function in JavaScript?

How to call a function in JavaScript. Calling a function (aka method) in JavaScript is similar to any other programming language that uses a C-like syntax. Simply call the function by name, then pass in any required parameters in a comma delimited list enclosed in parenthesis.

How check file is selected or not in JavaScript?

length property to check file is selected or not. If element. files. length property returns 0 then the file is not selected otherwise file is selected.


1 Answers

 jQuery("input#fileid").change(function () {     alert(jQuery(this).val()) }); 
like image 107
mike clagg Avatar answered Sep 20 '22 13:09

mike clagg