I have this html:
function() {
var resultado;
var a = $('div p').click(function(data) {
var i = $(this).prev().prev().before($('span')).text();
resultado = i;
});
return resultado;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="card">
<p class="subscription-header" style="font-size: 0.9em"><img src="/micuentamovil/appicon/219/46" /><a href="url">Text1</a><br /><span style="position: relative; top: -5px; font-size: 0.9em">Description</span>
</p>
<p class="banner"><img src="/url" />
</p>
<p class="link"><a href="url">Text2 >></a>
</p>
<p class="divider"></p>
<p class="actionlink-double">
<a href="url">option1</a>
<a href="url">option2</a>
</p>
</div>
I would like to return Text1 when I clicked on Text2. I'm trying this but it does not work:
Added
Forgive for the delay, indeed, what I'm looking for is when you click on Text2 > > return in a variable the text value of Text1, that is in this case Text1 .. Sorry not to have been clear. So far I get that in console.log or an alert the text appears but I can not return it in the return of the global function