Solved

How do I use jQuery to make sure all elements contained within a certain element (identified by class) become clickable and inherit the href url from a nested a tag?

Posted on 2015-01-14
1
192 Views
Last Modified: 2015-01-14
How do I use jQuery to make sure all elements contained within a certain element (identified by class) become clickable and inherit the href url from a nested a tag?

Please visit this page:
http://www.clarktogei.jp/%E3%81%94%E6%8C%A8%E6%8B%B6/

At the bottom of the page you will see three icons (pointing to other blog items). They are divs with class .item

Inside each there is an a href link.
I would like to be able to click any element within div.item (including div.item) and be able to go to the href of the nested a tag.

Please help

thanks in advance
0
Comment
Question by:badwolfff
1 Comment
 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 500 total points
ID: 40549245
Hi,
you might try the jQuery code from this sample:
http://jsfiddle.net/EE_RainerJ/znh39ayt/

I used your classes - so copy&paste and replacing the alert with the window.location = targetUrl should hopefully work.
HTH
Rainer
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now