Hello friend, Please visit the code and find my error. Thanks <script> $(function() { var hide; $('input[name="o1"]').on('click', function () { var that = this; hide = $(this).val() === 'sell' ? '.buy' ? '.transport' : '.transport' : '.sell' ; $(hide).fadeOut('slow', function () { $('.' + $(that).val()).fadeIn('slow'); }); }); }); </script> Code (markup):
What is the purpose of this ternary: hide = $(this).val() === 'sell' ? '.buy' ? '.transport' : '.transport' : '.sell'; Are you trying: if ( $(this).val() === 'sell' || $(this).val() === '.buy' || $(this).val() === '.transport' || $(this).val() === '.transport' || $(this).val() === '.sell' ) { hide = $(this).val(); } Also: var hide; declaration should be in the callback function of "on", but this is not the problem.
don't be afraid of white space. Break those big one line checks into several lines to help with debugging. Here's how I'd get started https://jsfiddle.net/qv1uva49/ but in actual fact your error is really simple - in that long comparison you are adding the "." to the class name and then in your fade out you are adding it again.