Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to detect value change on hidden input field
    primarykey
    data
    text
    <p>I have a <code>textarea</code> in my MVC application where I'm implementing <code>AspNetSpellCheck</code>, the debugger tells me that the <code>textarea</code> changes to <code>display: none; visibility: hidden;</code> and a <code>div</code> is generated with <code>id="abc"</code> and <code>class"="pqr"</code>.</p> <pre><code>&lt;input type="hidden" value="" name="userid" id="useid" /&gt; </code></pre> <p>Also I'm implementing change detection for all text area/other controls....</p> <pre><code>var somethingChanged = false; $(document).ready(function() { $('input').change(function() { somethingChanged = true; }); }); </code></pre> <p>Because the text area becomes hidden, I suppose it doesn't automatically fire the <code>change()</code> event. What is the solution to fire the event in above case? Thanks! </p> <p><strong>EDIT</strong></p> <p>With AspNetSpellCheck, below is my code,</p> <pre><code> @{ ASPNetSpell.Razor.SpellAsYouType mySpell = new ASPNetSpell.Razor.SpellAsYouType(); mySpell.InstallationPath = ("/Content/ASPNetSpellInclude"); mySpell.FieldsToSpellCheck = "TextArea1"; } &lt;textarea id="TextArea1" cols="20" rows="2"&gt;bedddly&lt;/textarea&gt; @Html.Raw(mySpell.getHtml()) &lt;script type="text/javascript" language="javascript"&gt; $(document).ready(function () { $('input[type="hidden"]').change(function () { debugger; alert('hi'); // somethingChanged = true; }); }); &lt;/script&gt; </code></pre> <p>Debugger produce below code, text area hidden and a new DIV construct,</p> <pre><code> &lt;div tabIndex="null" class="livespell_textarea" id="TextArea1___livespell_proxy"&gt; &lt;textarea id="TextArea1" style="display: none; visibility: hidden;" rows="2" cols="20"&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload