How do you set a value to a hidden field with javascript?

0

I’ve added a hidden field to my survey.  I would like to set the value of the hidden field to a value I calculated in javasript.  How do I do this?

 

Thanks

DataNerd1507 unselected answer
    0

    This would help on how to find the the element ID so you can change the value

    https://script.surveygizmo.com/help/article/link/how-to-find-element-ids-to-use-with-javascript

    Ivan Zh answered
      0

      Hi Stephen,

       

      I wonder what you’re trying to accomplish ultimately? Setting a hidden value with javascript is not an ideal situation because hidden values don’t have classes. This is something better done using custom scripting.

      You would have to use the id or get incredibly generic and just target all hidden inputs.  Something like: $(‘input:hidden’).val(‘Stuff you want to write’);

      Or: $(‘#hidden-value-id’).val(‘Stuff you want to write’);

      The first line would only be recommended if there’s only one as it will target all hidden inputs.

       

      Hope this helps!

      DataNerd1507 unselected as best answer
        ×

        Login

        Question stats

        • Active
        • Views2038 times
        • Answers2 answers
        • Followers0 followers