I have this code, it helps to select values from a list and pass them to a textarea but, I don’t want to duplicate in case accidentally pressing the same list value.
Heres is what i got:
window.onload = btnsInit;
function btnsInit()
{
var i, a = document.getElementById('btns').getElementsByTagName('a');
for (i = 0; i < a.length; ++i) {
a[i].onclick = btnClick;
}
}
function btnClick(e)
{
document.getElementById('ta').value += '' + this.firstChild.nodeValue + '\n';
xPreventDefault(e);
trim();
return false;
}
function xPreventDefault(e)
{
if (e && e.preventDefault) e.preventDefault();
else if (window.event) window.event.returnValue = false;
}
Any idea anyone?
Thank’s
Have you tried any checkings?
// FOR DEBUG PURPOSE