开发者

How to call two ID's alternatively with one button?

开发者 https://www.devze.com 2023-04-02 10:23 出处:网络
Take a look at example. <button id=\"go\">Expand</button> <button id=\"go1\">Collapse</button>

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();
}
});
});
0

精彩评论

暂无评论...
验证码 换一张
取 消