Hello, I have a jQuery click function that will need to include multiple if conditions, but not sure how it should be laid out. Basically, this is what I'm after-
$('#test').click(function() {
[ if- $('#message1').is(':visible') ]
[ then- $('#message2').fadeIn().fadeOut(); ]
[ otherwise- $('#message1').fadeIn().fadeOut(); ]
ALSO...
[ if- $('#message2').is(':visible') ]
[ then- $('#message3').fadeIn().fadeOut(); ]
[ otherwise- $('#message1').fadeIn().fadeOut(); ]
});
I need these conditions because there will be times when #message1 or #message2 is already visible by the time I click on #test. And I don't want more than one message to be visible at any time. So how would I accomplish this??