Do we have getElementsByClassName in javascript?

后端 未结 5 577
生来不讨喜
生来不讨喜 2020-11-27 08:09

Just like in jQuery we can use $(\".classname\"), is there a similar thing in javascript as well? Or if we don\'t have such method then how can i implement that.
Accordi

5条回答
  •  Happy的楠姐
    2020-11-27 08:10

    Unfortunately not consistently between browsers. If you don't need all of jQuery, but still would like to do selection based on CSS selectors, take a look at Sizzle, the selector library jQuery uses.

提交回复
热议问题