I was trying to change the value of a span with a specific id. Apparently, i am missing something. Here is the code
Javascript:
<script type="text/javascript">
function deis(deistir)
{
document.getElementById(deistir).innerHTML=2;
}
</script>
HTML:
<div class="arrow-up" onClick="deis(<?php echo "cevap_".$id;?>)">
</div>
<span style="font-size:30px; color:#333;" id = "<?php echo "cevap_".$id;?>">
1
</span>
You may wonder why i am using php for id. It is because html segments in while loop so that $id keeps changing. Why is it not becoming 2? I want to alter the value of span from 1 to 2 when there is a click event.