+ 3

Button help

HTML: <button type=“button” id=“BtnA” onclick=“?()” CSS: #BtnA { ‘Style’ } JS: function ?() { var a = “Hello”; document.getElementById(“001”).innerHTML = a( } -end- How can i make the button execute the code?

18th Dec 2017, 11:33 AM
JOHNTHEBUN
JOHNTHEBUN - avatar
3 Respuestas
+ 3
<!--I think you need to put on a real id, that's the code that I remade! you can see it :) --> <button type = "button" id = "BtnA" onclick = "Func()"> click </button> <script> function Func() { var a = "Hello"; document.getElementById ("BtnA"). innerHTML = a; } </script>
18th Dec 2017, 11:59 AM
James16
James16 - avatar
+ 3
getElementById("BtnA")
18th Dec 2017, 11:46 AM
Core i9
Core i9 - avatar
+ 3
yeah that's true. the ID is accessible for both CSS and JS and the ID must exist for use even in JS
18th Dec 2017, 12:02 PM
Core i9
Core i9 - avatar