On click of one of the options I am trying to get the data value from the 'ul li a' and place it into button below, I've set up a JS fiddle example here:
But cant seem to get it working
$('ul li a').click(function(e) {
e.preventDefault();
var value = $(this).data();
$('.button').data('value');
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.1/jquery.min.js"></script>
<ul>
<li><a data-value="50" href="#">Option 1</a></li>
<li><a data-value="40" href="#">Option 2</a></li>
<li><a data-value="10" href="#">Option 3</a></li>
</ul>
<a data-value="" class="button" href="">Go</a>
Does anyone have any ideas please?