javascript - Trigger is not working in jquery -
<div id="divuploadpic"> <form name="uploader" method="post" action="upload.php" enctype="multipart/form-data"> <input type="file" name="uploadedpic" id="uploadedpic" style="display: none;" /> <input type="submit" name="submituploadedpic" id="submituploadedpic" /> </form> </div> <script> $(function(){ $("#divuploadpic").click(function(){ $("#uploadedpic:hidden").trigger('click'); }); }); </script>
i have hidden input file tag , onclicking
div
, should triggered.$("#divuploadpic").click(function()
works fine trigger not working here. how resolve it?
for suggestion:
better use label
tag instead of div
perform without js
<label id="divuploadpic" for="uploadedpic">click <form name="uploader" method="post" action="upload.php" enctype="multipart/form-data"> <input type="file" name="uploadedpic" id="uploadedpic" style="display:none"/> <input type="submit" name="submituploadedpic" id="submituploadedpic" /> </form> </label>
Comments
Post a Comment