Here's my situation shipkifarm.com/recipes: I want to do a remote link from the post thumbnail to the post title. When I hover over the post thumb, I want the post title to be underlined (as if I had hovered over the post title). the problem is that the image is not in the same div as the title, but they do share an identical href attribute.
So, what I have so far:
var myHref = jQuery(\".recipeThumb a\").attr(\"href\");
var myLink = jQuery(\".recipeTitle a[href*='+ myHref +']\");
console.log(myLink)
Then I'd take the matched element and set the text-decoration to underline. Seems simple. What isn't working though, is when I pass a variable into the "href" selector in the myLink var I don't get a matched element. I know that the myHref var matches the url, and I know that when I pass a string into the href selector, I get a match. What isn't working is the variable as the selector...
I not sure i read the post properly but cant you just run a function that happens when you hover over the image, then in the function select the class of the title and add underline?
Here's my situation shipkifarm.com/recipes: I want to do a remote link from the post thumbnail to the post title. When I hover over the post thumb, I want the post title to be underlined (as if I had hovered over the post title). the problem is that the image is not in the same div as the title, but they do share an identical href attribute.
So, what I have so far:
Then I'd take the matched element and set the text-decoration to underline. Seems simple. What isn't working though, is when I pass a variable into the "href" selector in the myLink var I don't get a matched element. I know that the myHref var matches the url, and I know that when I pass a string into the href selector, I get a match. What isn't working is the variable as the selector...
Any ideas?
Thanks,
Doobie
Thanks for the reply, Al.
Cheers,
J
jQuery(\".recipeThumb a\").hover(function() {var myHref = jQuery(this).attr(\"href\");
var myLink = jQuery(\".recipeTitle a[href*=\"+ myHref +\"]\");
jQuery(myLink).addClass(\"underline\");
},
function(){
var myHref = jQuery(this).attr(\"href\");
var myLink = jQuery(\".recipeTitle a[href*=\"+ myHref +\"]\");
jQuery(myLink).removeClass(\"underline\");
});