Set the Value of a Hidden field using JQuery

后端 未结 3 1049
夕颜
夕颜 2021-01-04 00:27

I want to set the value of a hidden field, using JQuery.

Hidden Field:


相关标签:
3条回答
  • The selector should not be #input. That means a field with id="input" which is not your case. You want:

    $('#chag_sort').val(sort2);
    

    Or if your hidden input didn't have an unique id but only a name="chag_sort":

    $('input[name="chag_sort"]').val(sort2);
    
    0 讨论(0)
  • 2021-01-04 01:02

    If you have a hidden field like this

      <asp:HiddenField ID="HiddenField1" runat="server" Value='<%# Eval("VertragNr") %>'/>
    

    Now you can use your value like this

    $(this).parent().find('input[type=hidden]').val()

    0 讨论(0)
  • 2021-01-04 01:10

    Drop the hash - that's for identifying the id attribute.

    0 讨论(0)
提交回复
热议问题