Thanks for your reply. If I am following you correctly, then all the forms should be in one common div?
I already have one form in div within another container div.
So as per your suggestion, if i put say a another div containing the second form called loginFom but still under the containing div called FormContainer then the jquery code you wrote should work then?
This is how the html code is currently.
- First the div with the list items and data attributes set.
- Then the a container div holding the div with form.
I tried it out but the form is then already vissible from start. I will set up a codepen project, maybe it will be easier for you to follow.
- <div id="expressmenu">
- <ul>
- <li data-form="contactForm"><a href="#search" id="contactLink" class="icon-alone">
- <span aria-hidden="true" class="search_iconFont"></span>
- <span class="screen-reader-text">search</span>
- </a></li>
- <li data-form="logonForm"><a href="#logon" id="contactLink" class="icon-alone">
- <span aria-hidden="true" class="logon_iconFont"></span>
- <span class="screen-reader-text">logon</span>
- </a></li>
- <li data-form="blogForm"><a href="#blog" id="contactLink" class="icon-alone">
- <span aria-hidden="true" class="blog_iconFont"></span>
- <span class="screen-reader-text">blog</span>
- </a></li>
- <li><a href="#CV" id="contactLink" class="icon-alone">
- <span aria-hidden="true" class="cv_iconFont"></span>
- <span class="screen-reader-text">CV</span>
- </a></li>
- </ul>
- </div>
- <div id="FormContainer">
- <div id="contactForm">
- <form><br><br><br>
- <fieldset>
- <input type="text" autofocus required class="searchField" id="tags"placeholder=" Sök här..." autocomplete="off" />
- <button class="searchbutton" type="submit">Sök</button>
- </fieldset></form>
- </div>
- </div>