[Solved] how compare two variables which are inside two different functions i jquery?


You perhaps want to activate the content div based on the anchor clicked. Here are my updates :

var selector=".tabsclicked ul li";

$(selector).on('click', function () {
    $(selector).removeClass('activenav');
    $(this).addClass('activenav');
    var linkshref = [];
    var clickedHref = $(this).find('a').attr('href');

    $('.tabsclicked ul li a').each(function (i, el) {
        if ($(el).attr('href') != clickedHref) {
            linkshref[i] = $(el).attr('href');
        }
    });
    for (var i = 0; i < linkshref.length; i++) {
        $(linkshref[i]).removeClass('active in');
    }
    $(clickedHref).addClass('active in');

});

fiddle:http://jsfiddle.net/bko5g95e/4/

7

solved how compare two variables which are inside two different functions i jquery?