Not yet completed complete this. It having bug
by krish
HTML
<div id="box"><div>click in the box</div></div>
Click a name
<ul>
<li id="id-1">tom</li>
<li id="id-2">jerry</li>
</ul>
<div id="result"></div>
CSS
#box {
border: 1px solid #666666;
float: left;
display:none;
height: 200px;
width: 200px;
}
#box div {
position: absolute;
}
ul {float:left;}
#result, .item {
float: left;
width:100%;
}
JavaScript
var id;
var person;
jQuery(document).on("click", "li", function (event) {
id = jQuery(this).attr('id') || '';
person = jQuery(this).text();
$("#box").show();
});
$(function () {
$("#box").click(function (e) {
var isIndexed = $( "#result" ).text();
if(isIndexed > 0) {alert('textpresent');}else{alert('no text exist');}
var d = new Date();
alert(isIndexed.indexOf(person));
$( "#result" ).append( "<div class='item'>" + person + " last clicked the box at " + d + "</div>");
});
});