I have a div (A), and inside another div(B), and then i have my link. What I would like to happen is that When we click on A, the link inside div(B) works.
I succeeded to do it with one parent, but not 2...
$(".block").mouseover(function() {
if ($(".block .button").length) {
$(this).css("cursor", "pointer").find(".invisible.button").css("text-decoration", "none");
}
}).mouseout(function(e) {
e.preventDefault();
e.stopPropagation();
$(this).find(".invisible.button").css("text-decoration", "none");
}).click(function(e) {
document.location.href = $(this).find(".invisible.button").attr("href");
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<div class="wrap">
<div class="wrap-in block">
<p>content</p>
<a class="invisible button" href="mylink"> go</a>
</div>
</div>
I can't find the way to get my link work when clicking on the ".wrap" div, if anyone could help :)
one more information: if the "wrap" has no link, i have one more class :
The point is that if i just do :
$(".wrap").mouseover(function() {
if ($(".block .button").length) {
$(this).css("cursor", "pointer").find(".invisible.button").css("text-decoration", "none");
}
}).mouseout(function(e) {
e.preventDefault();
e.stopPropagation();
$(this).find(".invisible.button").css("text-decoration", "none");
}).click(function(e) {
document.location.href = $(this).find(".invisible.button").attr("href");
});
it works, but it works on the div without anylink too...
and i code this to stop the "nolink"
$('.nolink').on('click', function(e){
e.preventDefault();
e.stopImmediatePropagation();
});
Are you looking to do something such as this: