Hey everyone, I have this cool concept where clicking on different flags will reveal a corresponding list. However, my jQuery code doesn't seem to be functioning properly.
$('.canadaflag').click( function() {
$(".canadalocations").toggleClass("viewlocationlist");
$(".usalocations").toggleClass("hidelocationlist");
$(".guatemalalocations").toggleClass("hidelocationlist");
$(".colombialocations").toggleClass("hidelocationlist");
$(".perulocations").toggleClass("hidelocationlist");
} );
$('.usaflag').click( function() {
$(".usalocations").toggleClass("viewlocationlist");
$(".canadalocations").toggleClass("hidelocationlist");
$(".guatemalalocations").toggleClass("hidelocationlist");
$(".colombialocations").toggleClass("hidelocationlist");
$(".perulocations").toggleClass("hidelocationlist");
} );
$('.colombiaflag').click( function() {
$(".colombialocations").toggleClass("viewlocationlist");
$(".usalocations").toggleClass("hidelocationlist");
$(".canadalocations").toggleClass("hidelocationlist");
$(".guatemalalocations").toggleClass("hidelocationlist");
$(".perulocations").toggleClass("hidelocationlist");
} );
$('.guatemalaflag').click( function() {
$(".guatemalalocations").toggleClass("viewlocationlist");
$(".usalocations").toggleClass("hidelocationlist");
$(".canadalocations").toggleClass("hidelocationlist");
$(".colombialocations").toggleClass("hidelocationlist");
$(".perulocations").toggleClass("hidelocationlist");
} );
$('.peruflag').click( function() {
$(".perulocations").toggleClass("viewlocationlist");
$(".usalocations").toggleClass("hidelocationlist");
$(".canadalocations").toggleClass("hidelocationlist");
$(".colombialocations").toggleClass("hidelocationlist");
$(".guatemalalocations").toggleClass("hidelocationlist");
} );
If anyone could take a look and assist me with this, here is the link to the fiddle: