button按钮有两种情况:

1 <input type="button" >

这种button获取文字的代码是:

var buttonValue = document.getElementBy("button").value;

2 <button >button</button>

这种button获取文字的代码是:

var buttonText = document.getElementBy("button").innerHTML;

或者

var buttonText = document.getElementBy("button").innerText;

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-11
  • 2021-08-04
  • 2022-02-09
  • 2021-11-26
  • 2021-12-28
猜你喜欢
  • 2021-05-21
  • 2021-07-28
  • 2021-04-21
  • 2022-12-23
  • 2021-11-16
  • 2021-11-10
  • 2022-12-23
相关资源
相似解决方案