Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9239347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:58:00+00:00 2026-06-18T07:58:00+00:00

In this code, if I click the order details, that form should display, and

  • 0

In this code, if I click the order details, that form should display, and if I click the shipping details address that form should display and the order form should hide.
However here both the forms are displaying in my code.

   <!DOCTYPE html>
    <html>
       <head>
           <script>
         function orderdetails() {
    document.getElementById('orderdetails').style.display = "block";
       }
         function shippingdetails() {
     document.getElementById('shippingdetails').style.display = "block";
       }
         function ordersummary() {
          document.getElementById('welcomeDiv1').style.display = "block";
           }
          function payment() {
          document.getElementById('welcomeDiv1').style.display = "block";
            }   
     </script>
     </head>

     <body>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <a href="javascript:void(0);" value="Show Div" onclick="orderdetails()" >Order                                               Details</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
           <a href="javascript:void(0);" value="Show Div1" onclick="shippingdetails()">Shipping             Details</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
         <a href="javascript:void(0);" value="Show Div12" onclick="ordersummary()">Order Summary</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
           <a href="javascript:void(0);" value="Show Div12" onclick="payment()">Payment</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

       <div id="orderdetails"  style="display:none;" class="answer_list" > 
          <table width="200" border="0">
     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  <h3><u><b>Order Details</b></u></h3>
             <tr>
           <th scope="row"><label>Name*</label></th>
         <td><input name="name" type="text"></td>
          </tr>
          <tr>
           <th scope="row"><label>Email*</label>;</th>
             <td><input name="mail" type="text"></td>
            </tr>
           <tr>
              <th scope="row"><label>Mobile Number*</label></th>
         <td><input name="mobile" type="text"></td>
             </tr>
           <tr>
           <th scope="row"><label>Land Line</label></th>
           <td><input name="phone" type="text"></td>
           </tr>

        </table>

       </div>
          <div id="shippingdetails"  style="display:none;" class="answer_list" > 
           <br/>
             <table width="200" border="0">
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  <h3><u><b>Shipping Details</b></u></h3>
               <br/>
         <tr>
            <th scope="row"><label>Full Name*</label></th>
            <td><input name="name" type="text"></td>
           </tr>
          <tr>
               <th scope="row"><label>Address*</label></th>
         <td><textarea name="address" cols="" rows=""></textarea></td>
         </tr>
           <tr>
            <th scope="row"><label>Nearest Land Mark*</label>;</th>
           <td><input name="mail" type="text"></td>
          </tr>

         <tr>
            <th scope="row"><label>City</label></th>
           <td><input name="city" type="text"></td>
           </tr>
            <tr>
             <th scope="row"><label>State</label></th>
          <td><form name="form" id="form">
           <select name="jumpMenu" id="jumpMenu" onChange="MM_jumpMenu('parent',this,0)">
    <option>Tamil Nadu</option>
    <option>Kerala</option>
    <option>Orissa</option>
    <option>Delhi</option>
    <option>Andhrs</option>
    <option>Karntaka</option>
  </select>
</form></td>
   </tr>
         <tr>
         <th scope="row"><label>Pin Code*</label></th>
        <td><input name="code" type="text"></td>
               </tr><tr>
          <th scope="row"><label>Mobile Number*</label></th>
          <td><input name="city" type="text"></td>
          </tr><tr>
           <th scope="row"><label>Land Line</label></th>
           <td><input name="city" type="text"></td>
     </tr>
       </table>
     </div>

     </body>
      </html> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T07:58:02+00:00Added an answer on June 18, 2026 at 7:58 am

    Don’t just display the form, hide the others as well.

    function orderdetails() {
        document.getElementById('orderdetails').style.display = "block";
        document.getElementById('shippingdetails').style.display = "none";
    }
    function shippingdetails() {
        document.getElementById('shippingdetails').style.display = "block";
        document.getElementById('orderdetails').style.display = "none";
    }
    

    To prevent users from going back to the previous form, you can check if they have completed that particular form.

    In your form, give the required items a class name:

    <input name="name" type="text" class="order-required">
    <input name="mail" type="text" class="order-required">
    <input name="mobile" type="text" class="order-required">
    

    And give the “Order Details” link an ID:

    <a id="orderdetailslink" href="javascript:void(0);" value="Show Div" onclick="orderdetails()" >Order Details</a>
    

    Then put down the following before </body> to look for all the required fields in “Ordering Details”:

    <script>
    var elems = document.getElementsByTagName('*'), i, orderRequired = new Array();
    for (i in elems) {
        if((' ' + elems[i].className + ' ').indexOf(' ' + 'order-required' + ' ') > -1) {
            orderRequired.push(elems[i]);
        }
    }
    </script>
    

    Finally use the following functions to check if the user should be allowed to go back to the ordering details form.

    function orderdetailscomplete() {
        for (var i = 0; i < orderRequired.length; i++) {
            if (orderRequired[i].value.length == 0) {
                return false;
            }
        }
        return true;
    }
    function orderdetails() {
        if (!orderdetailscomplete()) {
            document.getElementById('orderdetails').style.display = "block";
            document.getElementById('shippingdetails').style.display = "none";
        }
    }
    function shippingdetails() {
        document.getElementById('shippingdetails').style.display = "block";
        document.getElementById('orderdetails').style.display = "none";
        if (orderdetailscomplete()) {
            document.getElementById('orderdetailslink').innerHTML = 'Order Details (completed)';
        }
    }
    

    See fiddle.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this little code here when click a link on webview that is
Here in this code: $('#doneItem').click(function(){ $(this).each(function(index){ var item = 'personal' + index; alert(item); localStorage.removeItem('personal'
This code works anywhere else.. form load, button click, etc. But when I add
I have this code in jquery : $(#order_btn).click(function(){ var totalprice = $(.price_amount).text(); $(#totalprice).val(totalprice); });
I have this code $(.delete2).click(function() { $('#load2').fadeIn(); } I have dynamically added item via
This code: $(#permalink a).click(function(id){ var id = this.getAttribute('href'); $(#newPostContent).load(id, function() { $(#removeTrigger).click(function() { $(#removeThis).hideToggle();
This code works perfectly except when you click on a link, The page is
This code disabled mouse scroll functionality, when i click on the document. $(document).on(click, function
In button click event I am writing this code.(code behind).I know button click event
I have this code: $('.user_info').click(function(){ var pos = $(this).offset(); rel_value = $(this).attr('rel'); $('#' +

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.