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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:55:45+00:00 2026-05-26T09:55:45+00:00

I have two divs with some elements in them (images, text, etc.), and I

  • 0

I have two divs with some elements in them (images, text, etc.), and I need to know which div is holding the element that was clicked. For example:

  • If I click on any element in div 1, then redirect to “pagina1.php”
  • If I click on any element in div 2, then redirect to “pagina2.php”

How can I do this in jquery?

  • 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-26T09:55:46+00:00Added an answer on May 26, 2026 at 9:55 am

    You can bind the click event to all the elements inside your divs, you can find out here how to do it http://api.jquery.com/click/, you could make something like this for each div:

    $('div#1 > *').click(function(e) {
      //This will tell you the tagname of the element that was click.
      alert($(this).tagName);
    
      //this will redirect you to pagina1.php might not be the best choice
      window.location.replace('pagina1.php');
    });
    

    And you have to do the same for div#2.

    You have to notice that the selector that I made is just for the first children of the div element.

    Saludos.

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

Sidebar

Related Questions

I have two divs both containing images. Here is some example code: <div id=one>
I have two divs. I would like to move/populate the text from div id
Suppose I have an div. Inside this div, I have two divs floating left,
I have a page with the following two divs: <div id=searchResults> </div> <div class=postSearchOptions
I have a div with two nested divs inside, the (float:left) one is the
I have a container div that holds two internal divs; both should take 100%
I have <a> elements in two different contexts on my page, some are in
I have two divs, one that holds some stuff and the other with all
I have one Parent div. Top of the Parent div contains two child divs.
I have been having this problem in IE. I have two divs which I

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.