If Else In Javascript
I have the following tabs on my page.
if ('New Joinees' in user.groups) {
- 'Business System
Solution 1:
Below code will set the first tab as current
for all 3 types of users.
$(document).ready(function() {
/* Apply current on Page load */
var $current = $('ul.tabs li:first-child');
$current.addClass('current');
$('.tab-content').css("border-top", "5px solid #3399CC");
$('#' + $current.attr('datatab')).addClass('current');
$('ul.tabs li').click(function() {
var contentid = '#' + $(this).attr('datatab');
$('ul.tabs li').removeClass('current');
$('.tab-content').removeClass('current');
$(this).addClass('current');
$(contentid).addClass('current').css("border-top", "5px solid " + $(this).css("background-color"));
});
});
Post a Comment for "If Else In Javascript"