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

  • SEARCH
  • Home
  • 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 8508007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:02:09+00:00 2026-06-11T03:02:09+00:00

I try to show and hide a div by the click of two different

  • 0

I try to show and hide a div by the click of two different links. (Actually my page got a lot of these sections so I had to give them an ID).

my html looks like this

<div id="meta-503d22ceaf32609515000003" class="answer-form">
    <form action="..." method="...">
        <p>
            <textarea name=".."></textarea>
        </p>
        <p>
            <input type="submit" value=".."> 
            <a href="#" data-action="cancel" data-id="503526f7e8d08ecb0c000003">cancel</a>
        </p>
    </form>
</div>
<span class="content-nav">
    <a href="#" data-action="open" data-id="503d22ceaf32609515000003">open form</a>
</span>

I have a span content-navigation when I click the link with data-action=open it opens the form. This works jus fine. But when I click cancle it should hide/close/slide up this answer form div.

Here is my jQuery-Javascript:

$(document).ready(function() {

    $("a[data-action=open]").on('click', function(e) {
        var id = $(this).data('id');
        console.log($("div#meta-" + id));
        $("div#meta-" + id).slideDown('slow');
    });

    $("a[data-action=cancel]").on('click', function(e) {
        var id = $(this).data('id');
        console.log(id);
        console.log(e);
        console.log($("#meta-" + id));
    });

});​

in the second bind click method it retrieves the id but the query

$("#meta-"+id) 

does not find anything in the secound method while the same call finds something in the first method.

How can I find the form and close it? Is it a scope issue because the cancel call (binding) is nested inside the form?

What do I miss here?

  • 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-11T03:02:11+00:00Added an answer on June 11, 2026 at 3:02 am

    If I am not mistaken, your Id for the cancel button looks different from the div Id

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

Sidebar

Related Questions

i try to show and hide divs on click but something isnt going wel
I am using JQuery to hide/show a div depending on the selected value of
Hi I am trying to create a page that uses the Hide and show
I try to show text box (#dimVal), when div(#CanvasArea) is clicked. And I want
I use a form where elements hide or show depends on click in the
CODE: $(document).ready(function() { $('.toggle').hide(); $('.show').click(function(){ $('.toggle').toggle('slow'); $(this).attr('src','images/checkmark2.jpg'); },function(){ $('.toggle').toggle('slow'); $(this).attr('src', 'images/checkmark1.jpg'); return false; });
Okay, here's my problem. I have a page where I use toggle to show/hide
This compiles: class Ex1 { public int show() { try { int a=10/10; return
iam using setting.bundle and i try to show a hidden picture with Switch toggle
I am getting an error when i try to show a diff set of

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.