Reputation: 31
$(document).ready(function(){
var $p = $('div.striker');
$("#show").click(function(){
$p.css('overflow', 'visible');
});
});
How to close on click buton ???
HTML
<div class="striker">
If you click on the "Hide" button, I will disappear.
If you click on the "Hide" button, I will disappear.
If you click on the "Hide" button, I will disappear.
If you click on the "Hide" button, I will disappear.
If you click on the "Hide" button, I will disappear.
If you click on the "Hide" button, I will disappear.
If you click on the "Hide" button, I will disappear.
If you click on the "Hide" button, I will disappear.
If you click on the "Hide" button, I will disappear.
</div>
<button id="show">Show</button>
Upvotes: 0
Views: 144
Reputation: 626
You can use any of these two options:
$p.css('visibility', 'hidden');`
This will hide the button but the space used is remain used.
$p.css('display', 'none');
This will hide the button and the space where the button previously appears is also released.
space - The region where the button is displayed.
Upvotes: 0
Reputation: 9351
if you want to hide on clicking on this show button use this:
$(document).ready(function(){
var $p = $('div.striker');
$("#show").click(function(){
$p.hide();
});
});
Live demo : http://jsfiddle.net/qsDn5/31/
If you want to switch display when clicking in the show button.
try this:
$(document).ready(function(){
var $p = $('div.striker');
$("#show").click(function(){
$p.toggle();
});
});
It will hide if it is displaying striker content and it will display striker content if its hide.
Live demo : http://jsfiddle.net/qsDn5/32/
Upvotes: 0
Reputation: 9542
For hiding show button
$("#show").click(function(){
$p.css('overflow', 'visible');
$(this).hide(); // or $(this).css('display','none');
});
Upvotes: 0
Reputation: 769
Instead of
`$p.css('overflow', 'visible');`
Try:
$p.css('display', 'none');
Upvotes: 0
Reputation: 2561
Change js to:
$(document).ready(function(){
var $p = $('div.striker');
$("#show").click(function(){
$p.css('display', 'none');
// or $p.hide();
});
});
Upvotes: 1