javascript - input type file, trigger the popup by a button click only -
i have file upload control:
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
Post a Comment