JSFiddle - React, Tailwind, and code Playground
HTML
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="jquery-1.7.2.js"></script>
<script type="text/javascript">
</script>
</head>
<body>
<div class="text"></div>
<a href="#">first</a> <a href="#">second</a>
<a href="#">both</a>
</body>
JavaScript
$(function() {
var myDate = {
'first': {
value: '30',
text: 'i am the one'
},
'second': {
value: '50',
text: 'i am the second'
}
}
$('a').click(function() {
var t = $(this).text();
if (t == "both") {
$('.text').text(myDate['first'].value + ' == ' + myDate['second'].value)
}
else {
$('.text').text(myDate[t].value);
}
})
})