As you know, the function toggle
was obsolete in the version of jquery 3.1 I remember that in previous versions I could do the following
$("button").toggle(function(){
$("p").hide()//just an example hide p tags
$("div").html("Goodnight stackoverflow comunity");
},function(){
$("p").show()//just an example show p tags
$("div").html("Goobye stackoverflow comunity");
})
this code what I did was that when I clicked a button I hid the p
tags and added a text to a div then when I clicked it again I hid them and changed the contents of the div, but this was obsolete from the version of jquery 3.1.1 how could I do the same in new versions of jquery?
that is, I need to do something similar to that code by clicking on a button to show a div with an information and change a text from show info
to hide info
and vice versa try the following but it only makes me the toggle of the div but I do not change the text this is my code:
$(document).on("click",".info",function(e){
e.stopPropagation();
$(".show-info").stop().fadeToggle(function(){
$("#show").html("hide");
},function () {
$("#show").html("Show");
});
})
$("html").click(function(){
$(".show-info").stop().slideUp();
})
})
someone who gives me a hand thanks in advance!