Skip hidden inputs in Jquery serialize

后端 未结 4 1713
无人及你
无人及你 2021-01-12 18:09

I have forms with inputs of hidden and visible like below.In this example I want to serialize only name=\'country\' which is not hidden

4条回答
  •  悲哀的现实
    2021-01-12 18:55

    Here is another possible solution with a demo.

    var notHidden = $('#finalform > :not(input[type=hidden])').serializeArray();
    
    $('#itemsSerializedCount').text($(notHidden).length)
    
    
    
    
    
    
    
    
    

    Here, the input control which is not hidden is serialized.

提交回复
热议问题