in this example, i have a button which has to change the text. Now I know that I can use the onclick=document.getElementById('id').innerHTML="text" but I am making a function such that
**onclick = myFunc()**
<script>
function myFunc()
var x = document.getElementById('id');
x.style.property = 'text';
</script>
so my question is , is there any property I can use which will change the text
innerHTMLwhy won't you use it?textContentproperty rather thaninnerHTML, but there's no CSS property available to JavaScript that can change the text of an element. Although you could use thecontentCSS property on generated elements which, so far as I know, are read-only to JavaScript. And even then will only read the original string, not the computed value (in the event of usingattr()orcounter()to set the value.