troubleshooting Question

Show maximum 4 forms on user actions

Avatar of Yakup K
Yakup K asked on
9 Comments2 Solutions92 ViewsLast Modified:
I have got a form shown on the page at first. Then I would like to show another 3 forms , on the user actions.


   <div id="form-0">

    form 0

    <div id="form-1" class="add-form">
    <a class="remove-form">X</a>
    form 1

    <div id="form-2" class="add-form">
    <a class="remove-form">X</a>
    form 2

    <div id="form-3" class="add-form">
    <a class="remove-form">X</a>
    form 3

<p class="request-text">Maximum of 4 per request</p>
<a href="#" class="add-another-form">+ Add another form </a>

$("a.remove-form").bind("click", function(e) {
    	    $(".add-form").css("display", "none");

counter = 0;

   function checkCounter() {
          if (counter > 4)
            $('.request-text').text('You have reached maximum 4 requests ');
            $(".request-text").css("color", "green");                

            return false;

          return true;
// Add form


     if (checkCounter()) {
    $(".add-another-form").bind("click", function(e) {
     $(".add-form").css("display", "block");


.add-form {
  display: none;

I have tried a few different way, but I could not be able make it work as expected. Any helps would be really appreciated.
Join our community to see this answer!
Unlock 2 Answers and 9 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros