Is it possible to find particular data inside an element on a click, and then write that data to a variable)?
For example, I have a list, with elements of class "datasource" that navigate to "#dataviewer":
<ul>
<li class="datasource">
<a href="#dataviewer" >Get this data</a>
</li>
</ul>
I know I can target that specific list element using something like this:
$(".datasource").click(function() {
alert("Click!");
});
... but can I fetch the "Get this data" and write it to a variable, in order to use that data on the '#datasource' page?
Many thanks.