3

I am using the jquery.raty script which does write a hidden field into my page like:

<input id="cancel-score" type="hidden" name="news_question_1" value="1">

I have this and many other form elements which I would like to monitor onChange.

I do this with:

$('#NewsletterSurveyForm').find(':input').each(function(){
        $(this).change(function(){....

Which works for all elements, but just not the hidden one.

Does anyone has an idea how to get its value?

makes
  • 6,438
  • 3
  • 40
  • 58

2 Answers2

8

you can use following code,

$("input[type='hidden']").change(function(){......});

but change event doesn't fire when the value is programmatically changed. so you have to trigger it manually when the value changes.

$("#hiddenId").val("new value").change();
Chamika Sandamal
  • 23,565
  • 5
  • 63
  • 86
1

I don't think the hidden input supports the change event.

See this question

I think you should address this change trigger a level higher up.

Community
  • 1
  • 1
Christian Dalager
  • 6,603
  • 4
  • 21
  • 27