javascript - form.submit() not working in the below code -
the javascript not submit form. on clicking alert called, checked object , not null. .submit() method not submit form. stuck here long time.
<script type="text/javascript"> $(document).ready(function(){ $("label img").click(function(){ alert("11"); $("#" + $(this).parents("label").attr("for")).click(); }); $("input").change(uploadform); }); </script> <script type="text/javascript"> function uploadform(){ alert("1"); document.getelementbyid('uploadfileformid').submit(); } </script> <form id="uploadfileformid" action="uploadfile" method="post" enctype="multipart/form-data" style="width: 40px"> <label for="uploadfileid"> <img src="images/button_up_lo.png" onmouseover="this.src='images/button_up_hi.png'" onmouseout="this.src='images/button_up_lo.png'" /> </label> <span id="uploadspanid" class="hidden"> <input type="file" name="uploadfilename" id="uploadfileid"/> <button type= "submit" id="uploadbuttonid" name= "uploadbutton" ></button> </span> </form>
- try
<input type="submit"> - use
$('#uploadbuttonid').submit();since using jquery. - element id case sensitive (
uploadbuttonidvsuploadfileformid)
Comments
Post a Comment