[removed] get contents of textarea, textContent vs. innerHTML vs. innerText

前端 未结 2 2010
小鲜肉
小鲜肉 2021-01-02 04:11

I am having trouble getting the contents of a textarea with js. I feel like I\'ve done this many times before without problems but something is throwing it off or I have a

2条回答
  •  青春惊慌失措
    2021-01-02 04:40

    For textarea, you could only use .value in your scenario (I tested your given code and it works fine). .

    Also,

    1) keep in mind that you call this function addProduct() ONLY after your element is mentioned in the code, otherwise it will be undefined.

    2) there must not be another element with id as productdescript

    3) there must not be a JS variable called productdescript

提交回复
热议问题