觸發(fā) ontoggle
屬性事件當(dāng)打開或關(guān)閉< details> 元件。
ontoggle
屬性在HTML5中是新的。
<details ontoggle="script">
<details>
details |
Yes | No | No | Yes | Yes |
<!DOCTYPE html>
<html>
<body>
<details ontoggle="myFunction()">
<summary>Open the summary</summary>
<p>this is a test.</p>
</details>
<script>
function myFunction() {
console.log("The ontoggle event occured");
}
</script>
</body>
</html>
更多建議: