How to display the last selection (div) of each tab, clicking?. By default displays the last div

How to display the last selection (div) of each tab, clicking?. By default displays the last div

Hello friends. How to display the last selection (div) of each tab, clicking?. By default displays the last div

jsfiddle:  http://jsfiddle.net/hvZHU/31/


  1. $("a.tab").click(function () {         
  2.    
  3.      var muestra = $(this).attr("name");
  4.      var mostrar = $("."+muestra).children('li').children('div');
  5.      var ocultar = $('.menuMod > ul.menuPrim > li > div').not('.ver > ul[class='+muestra+'] > li > div');
  6.     
  7.      ocultar.hide();  
  8.      mostrar.show();    
  9.          
  10. });