WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hi I have two JavaScript elements for logging into and create an account. They both overlap each-other when the div id is clicked and I need them to hide when the other id is clicked and vice versa.

<script type="text/javascript">
    jQuery('#sign-in').live('click', function(event) {        
    jQuery('#create-account').live('click', function(event) {        
share|improve this question

closed as off topic by s_ha_dum, brasofilo, toscho Apr 7 '13 at 5:49

Questions on WordPress Development Stack Exchange are expected to relate to WordPress within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 0 down vote accepted

Since you want them to alternate the easiest would be to use show() and hide() rather than toggle(), since you don't actually want to toggle the visibility if the login is clicked more than once, you want it to always show the #login and hide the #create. Also note that the live() function has been deprecated in favor of on(). See this example:

    jQuery('#sign-in').on('click', function(event) {        
    jQuery('#create-account').on('click', function(event) { 
share|improve this answer
thanks for the answer. I want to add some more code so when i click outside the div it hides. – wordpress_designer Apr 7 '13 at 4:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.