我试图触发section_1但它不起作用?我研究了它,因为我加载文件,我需要触发一个事件,但我很困惑。 section_1也没有添加该类。
我试过这个,但没有加载文件虽然jquery,这是有效的。我做错了什么?
$(function(){
$(document).on('click','.popup_upload', function(){
$('#upload').load('ajax/upload_contents.php');
});
// album, choose pic
$(document).on('click', '#add-album', function(){
$('#album-pic').trigger('click');
});
// album change function
$(document).on('change', '#album-pic', function(){
if(this.files && this.files[0]){
var reader = new FileReader();
reader.onload = function(e){
$('.placeholder_pic').attr('src', e.target.result);
}
reader.readAsDataURL(this.files[0]);
}
});
var tracks_display = $('.uploaded-tracks');
var number_of_tracks;
var name;
var origional_name;
var file;
var number_of_files;
var section_1 = $('#add-cover-id');
var section_2 = $('#add-tracks-id');
var section_3 = $('#add-upload-id');
$(document).on('click', '#validate_section_one', function(e){
e.preventDefault();
var album_name = $('#upload-name').val();
var genre = $('#upload-genre').val();
var price = $('#upload-price').val();
var album_cover = $('#album-pic').val();
var error = $('#panel2-1 .errorMsg');
if(album_cover == ""){
error.show().html('Choose a album cover!');
} else if(album_name == ""){
error.show().html('Give your album a name!');
} else if(genre == "0"){
error.show().html('Choose your album genre');
} else if(price == "0"){
error.show().html('Choose a price!');
} else {
section_1.addClass('disabled');
section_2.removeClass('disabled');
section_2.trigger('click');
}
});