Hi everyone,
Here i upload my live code
HTMl source:
`<span class="Maxi" id="frnd">Maxi</span>
<span class="John" id="frnd">John</span>
<span class="Henry" id="frnd">Henry</span>
<span class="Max" id="frnd">Max</span>
<span class="Simon" id="frnd">Simon</span>
<div id="warp">
<div id="chatwindow">
<div id="chathead">
<span id="uname"></span>
<div id ="close">×</div>
</div>
<div id="msgbody">
<textarea id="textar" ></textarea>
</div>
</div>
</div>
`
Js source
$(document).ready(function(){
$('span').on('click', function(){
var name=$(this).attr("class");
$("."+name).click(function(){
$("#chatwindow").toggle('#hide');
document.getElementById("uname").innerHTML = name;
});
});
Why i have to click two times on span class (from html source) for toggle it;??
and why it is toggling 3 0 4 times ?