I want to open a box when clicking on an element... and then make it desapear when I click on a "CLOSE" button... But this is not working. the box does appear by using "display:block" but it does not disappear with "display:none" (see code enclosed)
(I also tried with addClass and removeClass using a class with css attribut such as display:none but was not working as well.)
<html>
<head>
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.0/jquery-ui.js"></script>
<style>
div.back {
float: left;
background-color: grey;
width:100px;
height:100px;
margin:10px;
padding:10px;
}
.window {
display: none;
position: fixed;
top: 150px;
left: 150px;
width:150px;
height:100px;
background-color:blue;
}
</style>
<script>
$(document).ready(function(){
$(".back").click(function(){
$(".window").css("display","block");
});
$(".btn_validate").click(function(){
$(".window").css("display","none");
});
});
</script>
</head>
<body>
<div class="back">
Some text
<div id="draggable" class="window">
<input type="button" value="CLOSE" class="btn_validate"/>
</div>
</div>
</body>
</html>
$('.window').hide();and$('.window').show();. See: api.jquery.com/hide and api.jquery.com/show