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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:05:56+00:00 2026-06-13T14:05:56+00:00

I have been searching on a question like this but I cant find it.

  • 0

I have been searching on a question like this but I cant find it.

I have structure that looks like this:

<div id="productholder@(item.ProductId)" class="productholder">  
  <img src="@Html.DisplayFor(modelItem => item.Image)" alt="" />
  <div class="productinfo">
    <h2>@Html.DisplayFor(modelItem => item.Name)</h2>
    <p>@Html.DisplayFor(modelItem=> item.Description)</p>
    <br />   
  </div>
  <div class="productprice">     
    <h2>@Html.DisplayFor(modelItem => item.price):-</h2>          
    <input type="button" value="Ta bort" class="b" data-ProductImageId='@item.ProductImageId'>                          
  </div>                                   
</div>

What I want to do is that when somebody click on the button that has class="b" the whole div tag should get hidden with .hide() the problem is that I have 10 of these div tags that look the same so I cant specify a div tag, because its important that just the div tag inside the button that i clicked gets hidden.

I guess I need to use parent or something like that?

I have tried the following jquery scripts:

<script type="text/javascript">
    $(document).ready(function () {
        $(".b").click(function () {
            $("div:eq(0)").hide();
        });
    });
</script>

But I figure out it wont work beacuse it will hide the whole div wrapper.

Any kind of solution is appreciated!

  • 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-13T14:05:57+00:00Added an answer on June 13, 2026 at 2:05 pm
        $(".b").click(function () {
            $(this).parent().hide();
        });
    

    or

        $(".b").click(function () {
            $(this).parent().parent().hide();
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been searching around for this question but cant seem to find it.
It seemed like this question should have been asked before, but searching found nothing.
I thought this question would have been asked before, but I couldn't find it
I have been searching for an existing question for this one, but i am
This question might seem strange but I have been searching for an answer for
Here is my question. I have been searching a lot but i dont find
I have been searching the internet wildly for an answer to this question. We
I've been searching for an answer to this but I can't seem to find
I have tried searching for an answer to this but I cannot find anything
I know this is a beginner's question, but I've been searching online and all

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.