Can't set hidden input field's value using jQuery

前端 未结 11 1734
耶瑟儿~
耶瑟儿~ 2020-12-29 02:45

I have a simple input field inside a form tag:


  
11条回答
  •  攒了一身酷
    2020-12-29 03:01

    I figured it out. The value was set by jQuery but when I viewed the source the new value wasn't shown. I tried this (thanks to Fermin):

    $('#foo').val('poo')
    alert($('#foo').val())
    

    and it displayed the modified value.

提交回复
热议问题