Hiding a div or appending it dynamically

I have a register/login form. My current design is as follows

<div class="container"> <form class="register"> </form> <form class="login"> </form> </div>

I am using Jquery to show/hide divs.

Another approach could be

<div class="container"> //Empty Div </div>

Append/Remove divs dynamically when user clicks register/login button.

Which one is the best over anohter? What are the pros and cons of these methods. Any suggestions?


I think appending/removing the divs would be the worst solution because that would clear the state of the forms.. Like.. The user would lose information if he/she decided to go from one form to the other. But generally, they are both acceptable.

Category:javascript Time:2017-12-05 Views:1

Related post

  • Append a dynamic class to a view having a static class 2012-02-29

    How to append a dynamic class to a view that already has a static class? http://jsfiddle.net/MBmUs/4/ --------------Solutions------------- We've recently added this functionality to Ember. With a build off master, or after 0.9.6 is released, you can

  • How can I animate a height of a div starting from a dynamic value to its dynamic height value? 2010-06-24

    I want to use the effect of slideDown() for the first div to show it, starting from the dynamically generated height of last div to a height dynamically generated by its content within? In the code bellow the part with the problem is .animate({'heigh

  • Hiding contents without hiding the div? 2011-07-19

    This may be the simplest question ever, but try as I might I simply couldn't figure it out. I'm working on a website right now and I wish to use as few <div> elements as possible to keep the HTML pretty and easy to edit. At the moment I essenti

  • Wrapping divs based on a dynamic class? 2011-09-20

    Take the following HTML for example: <div class="container"> <div class="body">Content</div> <div class="body">Content</div> <div class="body">Content</div> <div class="header">Content</div> <d

  • Hiding a div on Mouse click out OR escape keyword press 2012-01-21

    I have the following code that hides my div (live search results) when mouse is clicked outside the div but I can't incorporate an OR function that does the same thing (hides div) when the escape key is pressed. Any help is much, much appreciated. Al

  • div max-height set dynamically using javascript 2012-01-27

    I have a web app using master page and content pages (see the attached image). I need to set max-width of one div in content page dynamically accordint to the browser window size (so that the whole app stays on the page, without scrolling). I couldn'

  • jquery append with dynamic divs from php loop 2012-02-01

    Here is a sample fiddle that I have working - http://jsfiddle.net/cuvsc/1/ It does what it's supposed to. It appends child divs to a parent div and sets the offset of child to be relative to the parent div(not body). So when I add br or p tags above

  • How to Load external Div that has a dynamic content using ajax and jsp/servlets? 2010-04-25

    I need to use ajax feature to load an external div element (an external jsp file) into the current page. That JSP page contains a dynamic content - e.g. content that is based on values received from the current session. I solved this problem somehow,

  • How append classes dynamically in jquery 2010-09-18

    in one of my variable i have something like var x='.myclass'. Now I want to append this var x while traversing the dom in jQuery.What should be the exact format for that. Lets say I want to write $("div.myclass a").someoperation(); now this .myclass

  • jQuery smooth div scroll not scrolling dynamically created paragraph tags 2011-10-10

    I'm building a stock ticker and I'm trying to use the Smooth Div Scroll plugin but I can't get it to work with dynamically created paragraph tags. Rather than creating a scrolling, horizontal list, it just dumps the P tags onto the page vertically. I

  • Appending a Dynamically Built Element to Another Dynamically Built Element 2012-03-30

    I have a jquery ui framework that is constructing the Date Picker elements. I also have jqtransform dynamically altering the input field. Bottom line I need to take the dynamically created <img> and append it to a parent div, three divs deep. T

  • Firefox page "moves" when hiding/showing divs 2009-03-23

    We have a web page with this general structure: <div id="container"> <div id="basicSearch">...</div> <div id="advancedSearch" style="display: none">...</div> <div> With this CSS: #container { MARGIN: 0px auto; WIDT

  • Showing and hiding a div with jQuery 2009-09-24

    When you click on the link, it with display the div "somecontent". And if you click on the link again, it will hide. How can I make the div show when hovering over the link and hide when moving away instead of showing and hiding on click? Here is the

  • Hiding a div using JQuery 2009-10-16

    I want to hide a div using Javascript, as soon as the page gets loaded in the browser. I am able to do that, if i use the following code : document.getElementById("div_id").style.display='none'; But, when i try to do the same thing using JQuery,i not

  • How do I change the height of a container div to fit all dynamic content? 2010-02-23

    you can find an example of my problem here: http://la.truxmap.com/truckpage?id=buttermilktruck the text content can be whatever size, from 2 lines, to the multiple paragraphs you see in the example. what i want is for the container with the white bac

  • CSS: How to make left float div to adjust height dynamically? 2010-02-25

    This question already has an answer here: HTML/CSS: Making two floating divs the same height 8 answers How can I make my floated left div with a static content to adjust automatically its height to the same height of the right floated div with a dyna

  • border-radius.htc support for hiding/showing divs? 2010-02-26

    I'm using border-radius.htc to simulate the border-radius CSS property in IE. It works fine, but I want to show and hide a div with rounded corners. The problem is that the border-radius.htc does not support advanced manipulation like hiding div, onl

  • jQuery hiding a div on click outside 2010-05-02

    I would like to build a simple menu for each list element clicked on but hide this div once you click outside it. Here is some simple code which hopefully will make sense. $('.drillFolder').click(function(){ var id = $(this).attr('data-folder'); $(".

  • Setting the height of div with unordered lists dynamically 2010-11-29

    Do I need to manually specify the height of a div which contains unordered list? When I have it like this, main1 and main2 div overlap if I don't set the height of the div. Is there a way of doing it without specifying the height? <div id='main1'

  • HTML DIVS expanding with content dynamically? 2011-01-16

    i have inside the body main 'container' div and inside this 'container' div there are three divs which are ,'header', 'content' and 'footer' my question is, i want the 'content' div to expand vertically with content increasing dynamically and by that

Copyright (C) pcaskme.com, All Rights Reserved.

processed in 0.872 (s). 13 q(s)