getElementsByClassName vs. jquery

前端 未结 8 581
遇见更好的自我
遇见更好的自我 2021-01-04 12:09

If my original function was:

document.getElementsByClassName(\'blah\')[9].innerHTML = \'blah\';

...how would I change that so I get that sa

8条回答
  •  一整个雨季
    2021-01-04 12:28

    You should also just be able to use jQuery's get() method:

    $('.blah').get(9)
    

    jQuery objects also function as indexed arrays as returned elements, so this should also work:

    $('.blah')[9]
    

提交回复
热议问题