How to show diffrent data inside a div

Hi at the moment I have some functions that recievs a variable

for example





function handleName(var){
???
}

function handleModules(var){
???
}

I also have the following html code


<a href="javascript:handleName(nameExample);">Show Name</a>

<a href="javascript:handleModules(57);"> Show number of modules</a>

<div id"Show data here"> I want the data to be showed here</div>


I want the functions handleModules and handleNames to print out the variable that it recieves in the div with the id “Show data here”, and the old data that was inside that div previously must dissapear to make room for the new data.

I must do this in javascript, so does anybody have an idea on how to accomplish this?

Thanks again for a great forum :slight_smile:

The simplest version would be something like this (assuming your DIV has the id ‘show’):


function handleName(var){
    document.getElementById('show').innerHTML = var;
}