2

Hi guys actually I want to call a function by clicking on open button of browse field of HTML.Is it possible,if yes then provide me information

user762267
  • 79
  • 1
  • 1
  • 5

2 Answers2

4

No. The "Browse" button is not accessible via JS (neither is just the text field next to it).

File uploads fields are very restricted not only regarding JS access - you cannot even style them properly.

ThiefMaster
  • 310,957
  • 84
  • 592
  • 636
  • When I click on browse button a window pop ups for selecting a file. I want to call an javascript function when some one click on "Open" button after selecting a file. Let me know if it is possible. – user762267 May 24 '11 at 09:24
  • Try registering a `change` event on the input element. – ThiefMaster May 24 '11 at 09:33
0

Basically there is restriction on browse button, but there is a solution by "onchange" event to call another js function. And you can do as you want, e.g: gmail file upload attachment, and shows all uploaded files and you can deselect each of them, so these type of js operation can be perform by OnChange method.....

and there is a lot of example to do work with browse button.altering on type=file

Community
  • 1
  • 1
Imran Khan
  • 2,373
  • 2
  • 22
  • 35
  • @user762267, hey man you can call a javascript function by onChange event, if you want can give you example. – Imran Khan May 25 '11 at 05:20