I tried this code but it still submit the form even the input has not been validated yet.
Here is the code for my form:
<a style="cursor: pointer;" id="upload_image">Upload Image</a></li>
<?php
$attributes = array('id' => 'upload_form');
echo form_open_multipart('c=web_page&m=upload_img', $attributes);
?>
<input type='file' style="display:none;" name="photosubmit" id="photosubmit"/>
<?php echo form_cose(); ?>
Here is the code for my jQuery:
$("#upload_image").click(function(){
$("#photosubmit").click();
if( $('photosubmit').val() != "") //
$("#upload_form").submit();
});
so here is my question:
How will I ensure that before I submit this form, my input has already a value..?