Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript how to dynamically hide or reveal tables rows as needed Reply To: how to dynamically hide or reveal tables rows as needed

#169310
Stuart Bennett
Participant
<script type="text/javascript">
/*
      https://css-tricks.com/forums/topic/how-to-dynamically-hide-or-reveal-tables-rows-as-needed/#post-169277
*/

var $ourServices = $('#subject'),
    $webDesign = $('#website'),
    $webHosting = $('#hosting'),
    $whichPlatform = $('#whichplatform'),
    $hiddenBoxes = $('#website, #hosting, #whichplatform');

$hiddenBoxes.hide();

$subject.change(function(){
  var $d = $(this).val();
  switch ($d) {
    case 'Website Design Enquiry':
      $hiddenBoxes.hide();
      $website.fadeIn();
      break;
      
    case 'Website Hosting Enquiry':
      $hiddenBoxes.hide();
      $hosting.fadeIn();
      break;
      
    case 'Mobile App Development Enquiry':
      $hiddenBoxes.hide();
      $whichplatform.fadeIn();
      break;
      
    default:
      $hiddenBoxes.hide();
      break;
  }
});
</script>

thats the js i am using.