fix bug $('.modal.item .tab.show').length() should be $('.modal.item .tab.show').length