HTML:
开发者_StackOverflow中文版<a href="#">Show next element</a>
<div>content</div>
jQuery:
$('a').toggle(function () {
    $(this).next().show();
},
function () {
    $(this).next().hide();
});
How do I change the above jQuery so it also changes the "Show" in the link to "Hide" when the element is visible?
Thanks!
Hasn't been tested...
$('a').toggle(function () {
    $(this).next().show();
    $(this).html("Hide next element");
},
function () {
    $(this).next().hide();
    $(this).html("Show next element");
});
$('a').toggle(function () {
    $(this).next().show();
    $(this).html('Hide next element');
},
function () {
    $(this).next().hide();
    $(this).html('Show next element');
});
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论