Hi everyone,
I’m trying to make a div clickable, i.e. when you click inside the div it takes you to a specified URL. I’m trying to use jQuery Find to look for attributes in the div and create the URL.
Here is a sample div:
[CODE]<div id=”post” post-username=”john-doe” post-id=”4585458″>
contents of the div go here
</div>
What I’d like to do is have jQuery search each div called post and then retrieve the attributes for post-id and post-username to form a URL like /john-doe/post/4585458/.
So far I have something like this:
[CODE]$(“#post”).click(function(){
window.location=$(this).find(“div”).attr(“post-username”);
return false;
});
But I’m not sure how to use Find to retrieve multiple attributes and concatenate them together to form the URL.
Any help would be appreciated.
Thanks.