heres a continuation from a previous post, if i have several of these forms generated from php like this
Code:
<FORM id='upload_0' class='upload' action='upload.php' enctype='multipart/form-data' method='post'>
<input type='hidden' name='MAX_FILE_SIZE' value='1048576'>
<input id='file0' type='file' name='uploadedfile' class='customfile-input'>
<input id='submit0' type='submit' name='submit' value='' class='upload' style='display:none;'>
</FORM>
<FORM id='upload_1' class='upload' action='upload.php' enctype='multipart/form-data' method='post'>
<input type='hidden' name='MAX_FILE_SIZE' value='1048576'>
<input id='file1' type='file' name='uploadedfile' class='customfile-input'>
<input id='submit1' type='submit' name='submit' value='' class='upload' style='display:none;'>
</FORM>
<FORM id='upload_2' class='upload' action='upload.php' enctype='multipart/form-data' method='post'>
<input type='hidden' name='MAX_FILE_SIZE' value='1048576'>
<input id='file2' type='file' name='uploadedfile' class='customfile-input'>
<input id='submit2' type='submit' name='submit' value='' class='upload' style='display:none;'>
</FORM>
and my jQuery functions look like this
Code:
$('#file0').click(function(){
$('#submit0').show(0);
});
$('#file1').click(function(){
$('#submit1').show(0);
});
$('#file2').click(function(){
$('#submit2').show(0);
});
how can i loop the code to make it more condense?
heres my attempt. the index doesnt seem correct
Code:
$('.customfile-input').each(function(index) {
$('#submit' + index ).show(0);
});
Bookmarks