I have an object which contains some details and in HTML I have three hyperlinks: first, second and both. I want it so that when I click on the hyperlinks I can match the object’s text and append it on the div.
<head>
<style>
.text { border:solid 1px #F00; height:30px;}
</style>
<script type="text/javascript" src="jquery-1.7.2.js"></script>
<script type="text/javascript">
var myDate= {
'first':'hi i am first object',
'second':'hi i am second object'
}
$(function (){
$('.text').text()
})
</script>
</head>
<body>
<div class="text"></div>
<a href="#">first</a> <a href="#">second</a>
<a href="#">both</a>
</body>
I would do something like this:
http://jsfiddle.net/vVmPW/