参考链接:https://stackoverflow.com/questions/10650233/checked-checked-vs-checked-true

问:

属性只有一个值的这类 html 属性是怎么回事,该如何设置值;比如:checked = “checked” vs checked = true

1 What is the difference between the below two usages?
2 
3 document.getElementById('myRadio').checked = "checked";
4 and
5 
6 document.getElementById('myRadio').checked = true;
7 For me, both are behaving the same way. But, I am just curious to know why there exist two methods to do the same.
8 
9 Which one will be the ideal usage? I need to support IE7 and higher versions.
View Code

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-05
  • 2021-12-06
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-04
  • 2022-12-23
相关资源
相似解决方案