1

我正在使用该<details></details>功能。有什么方法可以将自动显示的“详细信息”文本更改为自定义内容?

4

1 回答 1

1

如果您不提供<summary>元素,则默认显示“详细信息”;要更改这一点,只需使用<summary>(感谢 Jukka K. Korpela 在评论中指出默认显示)。请记住,<details>它没有得到很好的支持;如果您确实想使用标签:

<details class="mydetails">
    <summary>This is the text that show</summary>
    <p>This is the text that will show when you click on the summary text</p>
</details>

如果你想在页面加载后编辑文本,我建议只使用 jQuery:

$('.mydetails summary').html('Change the text to this');

现在您已经添加了 jsfiddle:

如果您想使用引导程序,那很好;在这种情况下,由于缺乏对<details>. 确保您已包含引导 css 和 js,并且您没有收到 404 错误。

这是一个显示 html 和 jQuery 的小提琴:http: //jsfiddle.net/Dc6jF/128/

于 2013-08-06T04:05:58.560 回答