December 18, 200916 yr I need to turn a div into a clickable link with jQuery, but without the usual method of fetching an href value from a pre-existing anchor element. I'm used to using that method with the following code: $(document).ready(function() { $("a.hidden").addClass("hide"); //hide link $("#div").addClass("click"); // style div $("#div").click(function () { window.location=$(this).find("a.hidden").attr("href"); return false; }); }); Now, in this instance, I have no suitable anchor to provide the necessary URL, so how can I change that code so that the relevant URL is in some way included in the JS? I assumed that this would be easy, but a web search found nothing.
Create an account or sign in to comment