Take a look at example.
<button id="go">Expand</button>
<button id="go1">Collapse</button>
I want if som开发者_如何学运维eone press Expand then expand function should work and automatically hide expand button and show Collapse button and when Collapse button is pressed then it should hide and Expand appear.
Thanks in Advance For All My Brothers For Giving Solution.
not exactly the copy to use answer but you can modify it to achieve your target
the html
<p id="disclaimer">
Disclaimer! This service is not intended for the those with criminal intent. Celebrities are kind of like people so their privacy should be respected.
</p>
<input type="button" id="toggleButton" value="toggle" />
the jquery
$(document).ready(function(){
$('#toggleButton').click(function(){
if($('#disclaimer').is(':visible')) {
$('#disclaimer').hide();
} else {
$('#disclaimer').show();
}
});
});
精彩评论