jquery not working to change inner html?

后端 未结 4 528
予麋鹿
予麋鹿 2020-12-03 18:03

hey people I\'m new at jquery and i have been trying to figure this out for like the past couple of hours... what the hell am I doing wrong here? All I want to do is change

4条回答
  •  春和景丽
    2020-12-03 18:56

    jQuery always returns a jQuery collection--not a DOM element. In order to access DOM properties directly, you'll need to retrieve an element from the collection:

    $(".left_menu_bar").first().innerHTML = "You clicked me!";
    

    This isn't very convenient, however, and helmus's answer describes the way that things are usually done.

提交回复
热议问题