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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:33:40+00:00 2026-05-22T19:33:40+00:00

I am trying to select the surround element when a image within the span

  • 0

I am trying to select the surround element when a image within the span is clicked ‘remove()’, but I am a little new to jQuery and can’t figure out how to do it. I can’t use a unique id as the element are generated dynamically.

For example:

<span class='type_link'> <img src='/images/deleteCross.gif' onclick='remove()' />Example</span>

I want to select the span when the image is clicked.

  • 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-22T19:33:41+00:00Added an answer on May 22, 2026 at 7:33 pm

    Here is an example to hide the parent element of the image:

    <span class='type_link'> <img src='/images/deleteCross.gif' onclick='$(this).parent().hide();' />Example</span>
    

    The trick is to use “this” and the parent()-function.

    Cheers,
    Chris

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

Sidebar

Related Questions

Trying to select a sibling element using jQuery and it doesn't work in IE7.
I am trying to select a certain value from a multi-element background-image property such
I am trying to select a image inside a link. JQUERY: $('#selskaber img').hover(function ()
In trying to select elements that have any attributes, the following throws a jQuery
In IDEA I can select a block of html and press ctrl+alt+t to surround
Im trying to select random datasets with DataMapper, but seems like there is no
I am sure making a silly mistake but I can't figure what: In SQL
trying to select next option drop down list by using a id identifier, but
I'm trying to select the newest OrderID by CustomerID. But it keeps saying I
I'm trying select a tr inside a table to delete it but am not

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.