How to get the content of ane element that called a function?
Hi
I've a code that creates a series of div element with some texts such innerhtml. I've added an onClick event to each of them, but actually i need to retrieve the text contained into the elmenet that called the funcion.
This is the code that creates dinamically the elements
PHP Code:
var elm=document.createElement('div');
elm.innerHTML=xmlhttp.responseText; //response from an ASP script called with AJAX
elm.setAttribute('onclick', 'prova(str)');
document.getElementById("risultatiRicerca").appendChild(elm)
function prova(str)
{
alert("Text into element: " + str);
}
How i can do it? Is it possibile or i've to create a "value"attribute for each element?