getElementsByClassName vs. jquery

前端 未结 8 641
遇见更好的自我
遇见更好的自我 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:32

    Another answer could be:

    $($(data).find('.blah')[9]).html();
    

    When you use [9] it returns a DOM object which doesn't know what function html() is but without [9] it returns a jQuery Object which the html() function is apart of.

提交回复
热议问题