I'm here at Stackoverflow again asking for help that will make it a lot easier for me, I want to do the following
I want to disable a button if the two inputs that are (Field and File) are empty
Here is the HTML code
<form method="post" action="#" enctype="multipart/form-data">
<div class="form-group">
<label for="artist_name">Artist name</label>
<textarea type="text" name="artist_name" class="form-control" id="artist_name" aria-describedby="emailHelp" placeholder="Enter artist name"></textarea>
</div>
<div class="form-group">
<label for="artist_biography">Artist biography</label>
<textarea name="artist_biography" class="form-control" id="artist_biography" placeholder="Add biography artist"></textarea>
</div>
<div class="form-group">
<label for="artist_social_fb">Artist Social Facebook</label>
<textarea style="resize:none;" name="artist_social_fb" class="form-control" id="artist_social_fb" placeholder="Enter artist social facebook"></textarea>
</div>
<div class="form-group">
<label for="artist_social_fb">Artist Social Instagram</label>
<textarea style="resize:none;" name="artist_social_ig" class="form-control" id="artist_social_ig" placeholder="Enter artist social instagram"></textarea>
</div>
<div class="form-group">
<label for="artist_social_fb">Artist Social Twitter</label>
<textarea style="resize:none;" name="artist_social_tw" class="form-control" id="artist_social_tw" placeholder="Enter artist social twitter"></textarea>
</div>
<div class="file-upload">
<label style="background-image: linear-gradient(to right, rgb(240, 152, 25) 0%, rgb(237, 222, 93) 51%, rgb(240, 152, 25) 100%);" for="upload" class="file-upload__label">Upload Photo Artist to <?php echo $wo['config']['msc_site_name']; ?> Music</label>
<input type="file" accept=".png,.jpg,.jpeg,.gif,image/*" name="artist_photo" class="file-upload__input" id="artist_photo">
</div>
<img style="text-align: initial;display: none;width: 170px;border-radius: 8px;" id="blah" src="#" alt="your image" />
<button id="button" type="submit" class="btn btn-primary m-t-15 waves-effect">Add new artist</button>
</form>
Here is the JAVASCRIPT Code
$(document).ready(function () {
$('button').attr('disabled', true);
$('textarea').on('keyup', function () {
var text_1 = $("#artist_name").val();
var text_2 = $("#artist_biography").val();
var text_3 = $("#artist_social_fb").val();
var text_4 = $("#artist_social_ig").val();
var text_5 = $("#artist_social_tw").val();
if (text_1 != '' && text_2 != '' && text_3 != '' && text_4 != '' && text_5 != '') {
$('button').attr('disabled', false);
} else {
$('button').attr('disabled', true);
}
});
});