Jquery – How to detect value change on hidden input field

asp.net-mvcjquery

I have a textarea in my MVC application where I'm implementing AspNetSpellCheck, the debugger tells me that the textarea changes to display: none; visibility: hidden; and a div is generated with id="abc" and class"="pqr".

<input type="hidden" value="" name="userid" id="useid" />

Also I'm implementing change detection for all text area/other controls….

var somethingChanged = false;
$(document).ready(function() { 
    $('input').change(function() { 
       somethingChanged = true; 
    }); 
});

Because the text area becomes hidden, I suppose it doesn't automatically fire the change() event. What is the solution to fire the event in above case? Thanks!

EDIT

With AspNetSpellCheck, below is my code,

  @{  

  ASPNetSpell.Razor.SpellAsYouType mySpell = new ASPNetSpell.Razor.SpellAsYouType();
   mySpell.InstallationPath = ("/Content/ASPNetSpellInclude");
   mySpell.FieldsToSpellCheck = "TextArea1";
}

<textarea id="TextArea1" cols="20" rows="2">bedddly</textarea>
@Html.Raw(mySpell.getHtml())

<script type="text/javascript" language="javascript">

$(document).ready(function () {
    $('input[type="hidden"]').change(function () {
        debugger;
        alert('hi');
        // somethingChanged = true; 
    });
});


 </script>

Debugger produce below code, text area hidden and a new DIV construct,

 <div tabIndex="null" class="livespell_textarea" id="TextArea1___livespell_proxy">

 <textarea id="TextArea1" style="display: none; visibility: hidden;" rows="2" cols="20">

Best Answer

With hidden values, you'll need to trigger the change event yourself ala:

$('#hiddenInput').val('newval').trigger('change');