javascript - input type file, trigger the popup by a button click only -


i have file upload control:

enter image description here

which has markup:

<div class="controls">     <input name="attachments[]"  id="attachment_control" runat="server" type="file" /><br />          <div id="fileuploads" runat="server"></div> </div> 

i want somehow fix control have popup shown on browse button click. now, anywhere you'll click in control, upload popup shown, want when user click on button, popup shown.

how can this?

$("#nofile").click(function() {        $("#fileuploads").click();        });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>  <div class="controls">       <label>file</lable>       <input type="button" value="upload" id="nofile"  width="30px"/>       <input type="file" id="fileuploads" runat="server" style="display: none;" />       </div>

this might

 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>  <div class="controls">  <label>file</lable>  <input type="button" value="upload" id="nofile"  width="30px"/>  <input type="file" id="fileuploads" runat="server" style="display: none;" />  </div>    <script type="text/javascript">   $("#nofile").click(function() {   $("#fileuploads").click();   });   </script> 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -