Показать сообщение отдельно
  #4 (permalink)  
Старый 23.03.2018, 15:38
Аватар для ksa
ksa ksa вне форума
CacheVar
Отправить личное сообщение для ksa Посмотреть профиль Найти все сообщения от ksa
 
Регистрация: 19.08.2010
Сообщений: 14,124

Сообщение от Artur_Hopf
Можно пример
Вот...
<!DOCTYPE html>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=windows-1251' />
<script src='https://code.jquery.com/jquery-latest.js'></script>
<!--
<script src="https://code.angularjs.org/1.3.9/angular.min.js"></script>
<script src="https://code.angularjs.org/1.3.9/angular-route.js"></script>
-->
<style type='text/css'>
#div_1 {
	border: 2px solid white;
}
#div_2 {
	border: 2px solid #b7ea79;
}
#div_1.on {
	border-color: #b7ea79;
}
#div_1.on + #div_2 {
	border-color: white;
}
</style>
<script type='text/javascript'>
$(function (){
	$('#div_1').click(function(){
		$("#div_1").addClass('on');
	});
	$('#div_2').click(function(){
		$("#div_1").removeClass('on');
	});
	$('button').click(function(){
		alert($("#div_1").hasClass('on'));
	});
});
</script>
</head>
<body>
<div id="div_1">div_1</div>
<div id="div_2">div_2</div>
<button>Test</button>
</body>
</html>
Ответить с цитированием