gpt4 book ai didi

jquery 无法更改内部 html?

转载 作者:行者123 更新时间:2023-12-03 22:23:52 25 4
gpt4 key购买 nike

嘿,大家好,我是 jquery 的新手,在过去的几个小时里我一直在试图解决这个问题......我到底做错了什么?我想做的就是更改 div 的innerHTML。

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

但是当我使用该代码 init 调用该函数时,div 根本没有改变。

最佳答案

这样做:

// referencing by id
$("#left_menu_bar").html("You clicked me!");
// referencing by class name ( will apply to all div's with this class )
$(".left_menu_bar").html("You clicked me!");

http://api.jquery.com/html/

关于jquery 无法更改内部 html?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9980230/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com