There is a nice standard jQuery function for toggling a class on a link. Imagine a new background colour being added to the a link.
$(document).ready(function(){
$('.blocklink a').click(function(){
$(this).parent().find('a').removeClass('active');
$(this).addClass('active');
return false
});
});
Simple but I was wondering if we could save some significant time for scripts such as these considering how often something like this is needed. — these
$(document).ready(function(){
$('.blocklink a').click(function(){
$(these).removeClass('active');
$(this).addClass('active');
return false
});
});
Is there a way to create the term these as a filler for whatever is the initial group of elements specified in a .click(function .scroll(function .mouseenter(function etc… etc…
To put it simply: No.
But you can use
.siblings()ti simplify it a little bit.