Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
93
rated 0 times [  100] [ 7]  / answers: 1 / hits: 18023  / 10 Years ago, mon, may 12, 2014, 12:00:00

I have a hidden file upload as it looks really bad, I have displayed a nicer looking button and would like it to click the hidden file upload when its clicked.



function ClickUpload() {
$(#FileUpload).trigger('click');
}

<div id=MyUpload>
<span id=FileName>Choose File</span>
<input id=uploadButton type=button value=Upload onclick=ClickUpload()>
</div>
<div id=hideUglyUpload>
<input type=file name=FileUpload id=FileUpload/>
</div>


So far i can move into the function ClickUpload() but it just passes through the click without the file selection window popup.


More From » jquery

 Answers
6

Strange that it doesn't work. Try



<input id=uploadButton type=button value=Upload onclick='$(#FileUpload).click()'> 

[#71057] Sunday, May 11, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
grayson

Total Points: 36
Total Questions: 113
Total Answers: 95

Location: Tonga
Member since Fri, Aug 21, 2020
4 Years ago
grayson questions
;