Suren Baskaran Suren Baskaran - 1 month ago 17
CSS Question

Adding a onclick event to a span

I am struck with adding a onclick function to my span - though it looks simple - I am sure - there is something I am missing

https://jsbin.com/naqejanigu/edit?html,css,js,output

Answer
function conv() {
  var cel = document.getElementbyId('unit');
  cel.innerHTML = 'F';
}

function conv() {
  var cel = document.getElementById('unit');
  cel.innerHTML = 'F';
}

getElementbyId should be getElementById. 

enter image description here