you can easily do this in jquery.. if you're interested in using another library such as jquery..
Js
var description;
$('#description').click(function(){
description = $(this).val();
//alternatively you can use data-description and retrieve it like so:
description = $(this).data('description');
//if that doesnt work use attr();
description = $(this).attr('data-description');
//this will return "My awesome description"
console.log(description);
}
php
<?php
$description = 'My awesome description';
?>
html
<a id="description" href="#"><?= $description; ?></a>
<!-- alternatively you could used data-description attribute on the href and pass that.. -->
<a href="#" data-description="<?= $description; ?>">Link 1</a>
<?php echo json_encode($description); ?>