SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: jquery help

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    207
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    jquery help

    PHP Code:
    <html>
    <
    head>
    <
    script src="http://code.jquery.com/jquery-latest.min.js"></script>
    </head>
    <body>
    <button id="pay">Paypal</button><button id="fren">Frenchise</button>

    <form method="POST" action="done" id="pay1" style="display: none;" >
    Enter Paypal ID<input name="pay" type="text" />
    </form>



    <form method="POST" action="done" id="fren1" style="display: none;">
    Frenchise Name<input name="fren" type="text" />
    </form>


    <script>
        $("#pay").click(function () {
        $("#pay1").show("slow");
        });
        $("#fren").click(function () {
        $("#fren1").show("slow");
        });
        </script>
        </body>
    </html> 
    i just need one thing more in this code that one we click on other button the form first form automatic hide and only that form show on which button we click

  2. #2
    SitePoint Addict
    Join Date
    Jul 2007
    Location
    San Jose, California
    Posts
    355
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I believe this is what you're looking for:
    Code JavaScript:
    <script> 
        $("#pay").click(function () { 
            $("#pay1:hidden").show("slow"); 
            $('#fren1:visible').hide();
        }); 
        $("#fren").click(function () { 
            $("#fren1:hidden").show("slow");
            $('#pay1:visible').hide();
        }); 
    </script>

    It will only run the show function if the selected div is not visible(hidden).
    It will only run the hide function if the other form is visible.

  3. #3
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    207
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    tHanksss


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •