HTMLInputElement has no method 'val'

前端 未结 5 922
走了就别回头了
走了就别回头了 2021-02-05 02:28

I\'m looping through cells in a table row. each cell has a text box in it, and I want to take the value of the text box and push it onto an array.

function dothi         


        
5条回答
  •  孤城傲影
    2021-02-05 02:50

    .val() is a jQuery function, not a javascript function. Therefore, change:

    var val = $(this).children('input')[0].val()
    

    To:

    var val = $(this).children('input:eq(0)').val()
    

提交回复
热议问题