Get All Elements in an HTML document with a specific CSS Class

前端 未结 10 865
时光取名叫无心
时光取名叫无心 2020-12-01 04:10

What\'s the best way to get an array of all elements in an html document with a specific CSS class using javascript?

No javascript frameworks like jQuery allowed her

10条回答
  •  一生所求
    2020-12-01 04:43

    Use jquery, it can't be more convenient.

    $(".theclass") or $(".theclass"),makeArray() if you want a native JS array

提交回复
热议问题