DOM Javascript | Sololearn: Learn to code for FREE!

+3

DOM Javascript

How can I get the value of this button in javascript? 👉 <button type="button" id="btn3" value="3" onclick="3">3</button>

4/10/2021 3:29:51 PM

Raidel González Cabrera

7 Answers

New Answer

+6

With its id.

+4

myBtn3 = getElementById("btn3"); For more please save your code on SL Playground and provide a link here.

+3

Raidel González Cabrera this can be done for example like here: https://code.sololearn.com/Wz1xFwext2Z3/?ref=app

+2

I'm trying to do a calculator. Help plz https://code.sololearn.com/WVE6ATE9Xj2A/?ref=app

+1

0

document.querySelector(‘#btn3)

0