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 6548429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:58:15+00:00 2026-05-25T11:58:15+00:00

I have a webpage with a form for posting comments( a textfield and a

  • 0

I have a webpage with a form for posting comments( a textfield and a textarea + submit button).I wanted the form to be invisible at first and show only a ‘showform’ link to make the form visible as well as to show the ‘hideform’ link.When ‘hideform’ link is clicked ,the form & the hideform link should be made invisible ,and the showform link should be made visible again.
I tried this

<html>
<head>
<title>formopen demo</title>
<link href="formopen.css" type="text/css" rel="stylesheet">
</head>
<script src="jquery-1.4.2.js"></script>
<script src="formopen.js"></script>


<body>
<div class="myjsdemo">
   <a href="#" class="showaddcommentformlink">show add commentform</a>
   <a href="#" class="hideaddcommentformlink">hide add commentform</a>
   <div class="form">
      <input type="text" value="" name="myinput" id="myinput"/>
      <textarea name="content" rows="2" cols="20" id="content" > </textarea>
   </div>
</div>

</body>
</html>

formopen.css

.myjsdemo .form{display:none;}
.myjsdemo .hideaddcommentformlink{display:none;}

formopen.js

$(function(){
    $('.myjsdemo.showaddcommentformlink').click(
      function(){
            $(this).hide();
            $('.myjsdemo.hideaddcommentformlink').show();
            $('.myjsdemo.form').show();
            return false;
        }
    );

    $('.myjsdemo.hideaddcommentformlink').click(
      function(){
            $(this).hide();
            $('.myjsdemo.showaddcommentformlink').show();
            $('.myjsdemo.form').hide();
            return false;
        }
    );

});

However nothing happens when I click on the link…I have very minimal knowledge of javascript ..If someone can correct any mistakes in this code ,it would be a great help..

I am putting all files in the same directory and opening the html file in firefox.

thanks

  • 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-05-25T11:58:15+00:00Added an answer on May 25, 2026 at 11:58 am

    Try to add a space between the CSS classes.

    .myjsdemo.showaddcommentformlink
    

    Should be

    .myjsdemo .showaddcommentformlink
    

    And so on. Otherwise jQuery will grab elements that have both the classes applied at the same time.

    The final function should be like this one:

    $(function(){
        $('.myjsdemo .showaddcommentformlink').click(
          function(){
                $(this).hide();
                $('.myjsdemo .hideaddcommentformlink').show();
                $('.myjsdemo .form').show();
                return false;
            }
        );
    
        $('.myjsdemo .hideaddcommentformlink').click(
          function(){
                $(this).hide();
                $('.myjsdemo .showaddcommentformlink').show();
                $('.myjsdemo .form').hide();
                return false;
            }
        );
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a webpage with search form fields and on click of submit button,
I have a webpage that on a button click grays out the main form
I have a webpage with 3 frames. The first frame has a form and
I have a mobile webpage that is just a simple form with a submit
I have a webpage with a form element and a popup window (opened by
I'm using django, and have a static webpage with a GET form, and about
I have a few asp:textbox controls in a form on a webpage, below is
I have a simple web app: a web page with a form to submit,
I have a sample webpage: <form action=blabla.php methog=post>...</form> <form action=blabla.php methog=post>...</form> <form action=blabla.php methog=post>...</form>
I use jQuery form validation plugin . I have got a webpage with save

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.