Uncaught TypeError: Cannot read property 'push' of undefined

前端 未结 1 889
不思量自难忘°
不思量自难忘° 2021-01-26 09:26

Hello Everyone I have used jquery to generate a textbox.It is generated dynamically through jquery.Now the problem is i want to fetch the textbox value in ajax function and then

相关标签:
1条回答
  • 2021-01-26 10:15

    This is because you are not setting a value to the variable dynamic_text:

     var dynamic_text;
    

    As such it's value will be undefined. And clearly undefined doesn't have a .push() method; that's what the error is saying:

    Cannot read property 'push' of undefined

    You will want to define your variable as an array:

    var dynamic_text = [];
    
    0 讨论(0)
提交回复
热议问题