I am using a script that disables the submit button unless the user clicks and browses for a file to upload.
$(document).ready(function() {
$('input:submit').attr('disabled',true);
$('input:file').change(
function(){
if ($(this).val()){
$('input:submit').removeAttr('disabled');
}
else {
$('input:submit').attr('disabled',true);
}
});
});
I have 2 forms on the same page and I would like this tied to a specific form.
First form:
<form action="" method="post" name="name1" id="id1">
Second form:
<form action="" method="post" name="name2" id="id2">
is there a way in the javascript to attach it to #id1 specifically and not id2?
would I place it like this? $('#id1.input:submit') – what is the symbol or syntax to add the id into the script? Sorry I’m still learning which parts you can combine.
replace
$('input:submit').attr('disabled',true);by$('form#id1 input:submit').attr('disabled',true);