I have a Rich Text field that I want to be able to reset to the default value. I can see the default value in the HTML, like so:
<div id="RTFEditor-Field123" name="RTFEditor123" class="rich-text-editor" style="height:200px" type="richtext" vo="u" default-val="<p>There is a paragraph here...</p><p><br></p><ul><li>And a bullet point here</li><li>Another bullet point here</li><p>etc...</p>"</div>
Assuming I use a "Restore Default Value" button to trigger the function, how can I replace the current contents with the default value? I have the beginnings of a function using javascript (on Forms 11, using Classic Designer), but if anyone has other suggestions I'd be open to them!
$(document).ready (function () { const resetRTField = function resetRTField (){ var $rtField = $('li[attr="My_RichText_Field"] div[type="richtext"]'); // I can find the div mentioned above like so, but am not sure how to parse out the default value element var defaultValue = $rtField[0].children[1];//.getmethedefaultvalue // now replace the current rich text with the default value rich text // ....? } $('.resetField').on('click', resetRTField ); });