DOM Properties
HTMLDialogElement.returnValue
Read/write. Stores the dialog's result string. A close call with a result or a form submission using method=dialog can update it. It is not automatically cleared before every opening; initialize it when starting a new interaction. Example result: ok.
Formal Syntax & Structure
html syntaxhtml
element.returnValueReturn Value
string
Property value. Read/write.
Working Example
Example Snippethtml
<dialog id="demo" aria-label="Notice">Notice</dialog><p> Result: <output id="result"></output></p><script> const e = document.getElementById('demo'); const result = value => { document.getElementById("result").textContent = String(value); }; e.show(); e.close('ok'); result(e.returnValue);</script>Browser Compatibility
Minimum supported versions across modern rendering engines
Widely Available (2022)
Blink
Chrome
37+
Yes
Gecko
Firefox
98+
Yes
WebKit
Safari
15.4+
Yes
Basic feature support; newer dialog members have their own compatibility.
HTML Living Standard