When I click on an element, I want a box to open and then when I click on a "CLOSE" button, I want it to disappear. However, I am encountering an issue where the box appears using "display:block" but does not disappear with "display:none" as intended (see enclosed code).
I also attempted using addClass and removeClass with a CSS attribute like display:none, but that did not work either.
<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>