Hide everything first & handle the one you have clicked later.
$('div.article').click(function(){
var clickedbox = $(this).attr('id');
$('.boxcontent').hide();
$('#' + clickedbox + ' span.boxcontent').show();
});
سؤال
I have more boxes on the same page, with this code i can enable individually boxes, but how can i disable old box if i click on a new box?:
$('div.article').click(function(){
var clickedbox = $(this).attr('id');
$('#' + clickedbox + ' span.boxcontent').show();
});
I have tried this to do also with jquery and with .mouseleave, but that's not good for mobile devices.
المحلول
Hide everything first & handle the one you have clicked later.
$('div.article').click(function(){
var clickedbox = $(this).attr('id');
$('.boxcontent').hide();
$('#' + clickedbox + ' span.boxcontent').show();
});