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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:46:09+00:00 2026-05-16T20:46:09+00:00

In the below code how to pass the div object inside validate function <div><input

  • 0

In the below code how to pass the div object inside validate function

  <div><input type="text"></input>&nbsp;&nbsp;&nbsp&nbsp;<a href="#" onclick="validate("Hot to pass the div objevt here")"</input> 

   <script>
    function validate()
    {
      .....
      .....
       Finally remove the div   
    }

     </script>
  • 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-16T20:46:09+00:00Added an answer on May 16, 2026 at 8:46 pm

    HTML:

    <div class='elementToRemove'>
        <div>
            <a href="#" onclick="validate(this)">some text</a>​​​​​​​​​​​​​​​​​​​​​​​
        </div>
    </div>
    

    javascript:

    function validate( elem ) {
        $(elem).closest('div.elementToRemove').remove();
    }
    

    In the validate() function, elem will represent the <a> element that received the event.

    Then you can wrap it in a jQuery object, and use .closest() to get the first <div> ancestor, and use .remove() to remove it from the DOM, and clean up any data attached, like event handlers.

    Or perhaps preferable to have jQuery take care of your event handlers:

    HTML:

    <div class='elementToRemove'>
        <div>
            <a href="#" class="someClassName">some text</a>​​​​​​​​​​​​​​​​​​​​​​​
        </div>
    </div>
    

    jQuery:

    $('a.someClassName').click(function() {
        $(this).closest('div.elementToRemove').remove();
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 532k
  • Answers 532k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Ordinarily, I'd get this resolved by commenting @Sam on the… May 17, 2026 at 12:14 am
  • Editorial Team
    Editorial Team added an answer You need to add the columns to the DataTable. I've… May 17, 2026 at 12:14 am
  • Editorial Team
    Editorial Team added an answer It is not an easy job to layout all the… May 17, 2026 at 12:14 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have below html code in my aspx. <input type=hidden id=medicalLink value='<a href=/forms/contactus.aspx >Contact
I got the code below how do I pass the current object this into
the below ASPX code is ok : <asp:Label ID=lblShowInRPV1 runat=server Text=<%# Method() %>></asp:Label> is
I am facing a peculiar behavior in php header function. The code below works
The below code works as far as I can tell except for the var
This situation can only occur without name mangling (I believe), so the below code
I have a javascript object which has some defined variables and attaches some event
I have been studying the modalforms & inline formsets but am not able to
Hello folks, I've got the issue to add a browser event to some input
How can I load a new page in my particular div using ajax in

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.