i want to show a form once a certain button is clicked. i tried some methods like
1)i add the form initially to the HTML and give it a hidden property then change it with .show() or .css() my problem is it takes a space of the page.
2) i used .appened() to add the form but the form is too long and it never works.
what’s the best way to hide an element first then show it in JQuery ?
You assigned the wrong css. Use
display:none;:And, to show it:
This works, guaranteed. With
display:none;, it doesn’t occupy space. You certainly may have usedvisibility:hidden;that was your mistake (because it does occupy space)Hope this helps. Cheers