gpt4 book ai didi

javascript - 如何在标签strong中设置文本?

转载 作者:太空狗 更新时间:2023-10-29 15:25:56 25 4
gpt4 key购买 nike

我想知道我是否可以在 <strong> 中设置文本或初始文本在 JavaScript 中。

<!DOCTYPE html>
<html>
<body>
<script>
$(document).ready(function(){
// what should I do here?
}
</script>
<strong>Strong text</strong>
</body>
</html>

非常感谢。

最佳答案

最好将 classid 添加到 html 元素,如下所示:

JS :

$(document).ready(function(){
$(".text").html("Your content here...");
});

HTML :

<strong class="text">Strong text</strong>

演示:http://jsbin.com/cihilobe/1/

关于javascript - 如何在标签strong中设置文本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23534268/

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