Hello everybody! There is a pop-up form (click on the button - the form appears on the page), but when you close it (click on the cross), the page reloads. How can I fix this?
$(document).ready(function() { $(".show_popup").click(function() { $("#cooperation-form").appendTo('body').toggle(); $("#all").css({ "opacity": 0.5, "background": "black", "z-index": 5 }); $("#cooperation-form").css("z-index", 10); }); $(".close-form").click(function(event) { $("#cooperation-form").hide(); }); });
$(document).ready(function() { $(".show_popup").click(function(){ $("#cooperation-form").appendTo('body').toggle(); $("#all").css({"opacity":0.5,"background":"black", "z-index":5}); $("#cooperation-form").css("z-index",10); }); $(".close-form").click(function (event){ $("#cooperation-form").hide(); event.preventDefault(); }); });show_popupis the button on which the form is called.allis a div to the whole page, right after thebody. After the method you suggested, the page stopped reloading at closing, but the dimming is active. How to fix it? - prolina