Get the Value of an asp:HiddenField using jQuery

后端 未结 8 2292
慢半拍i
慢半拍i 2020-12-15 16:36

I have two pages. From the first page, I open a modal with a querystring that holds that value of a client name. I then use this to set a hiddenfield on the modal that opene

8条回答
  •  再見小時候
    2020-12-15 16:49

    You forgot the # in your selector to select by ID:

    var hv = $('#hidClientField').val();
    

    Although asp.net generates ID based on the naming containers so you might end up with an ID like ctl1$hidClientField. You can then use the "attribute ends with" selector:

    var hv = $('input[id$=hidClientField]').val();
    

    Check the documentation about jQuery selectors

提交回复
热议问题