Skip to content

Commit 6cbe32e

Browse files
docs(forms): update samples and docs
- Updated usage sample of "Forms::textareaAutoResize": - Updated explanation (why and when to use it); - Updated sample so as to remove jQuery syntax.
1 parent f33bde9 commit 6cbe32e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pug/contents/text_inputs_content.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -308,10 +308,10 @@ <h3 class="header">Textarea</h3>
308308
&lt;/form>
309309
&lt;/div>
310310
</code></pre>
311-
<p>advanced note: When dynamically changing the value of a textarea with methods like jQuery's <code class="language-markup">.val()</code>, you must trigger an autoresize on it afterwords because .val() does not automatically trigger the events we've binded to the textarea. </p>
311+
<p><strong><b>Advanced note:</b></strong> When dynamically changing the value of a textarea like setting <code class="language-markup">HTMLElement#value</code> attribute, you must trigger an autoresize on it afterwords because simply updating the element's value does not automatically trigger the events we've binded to the textarea.</p>
312312
<pre><code class="language-javascript">
313-
$('#textarea1').val('New Text');
314-
M.textareaAutoResize($('#textarea1'));
313+
document.querySelector("#textarea1").value = 'New Text';
314+
M.Forms.textareaAutoResize(document.querySelector('#textarea1'));
315315
</code></pre>
316316

317317

0 commit comments

Comments
 (0)