Source Code:
(back to article)
Submit
Result:
Report an issue
9
1
2
3
4
5
6
7
8
›
⌄
⌄
⌄
<
div
>
<
p
id=
"text"
>Double-click me to toggle text size.</
p
>
</
div
>
<
script
>
document.getElementById(
'text'
).addEventListener(
'dblclick'
,
function
() {
this
.style.fontSize =
this
.style.fontSize ===
'16px'
?
'32px'
:
'16px'
;
});
</
script
>
<div> <p id="text">Double-click me to toggle text size.</p> </div> <script> document.getElementById('text').addEventListener('dblclick', function() { this.style.fontSize = this.style.fontSize === '16px' ? '32px' : '16px'; }); </script>