When do I use .val() vs [removed]?

后端 未结 5 893
慢半拍i
慢半拍i 2020-12-10 13:29

In JQuery when trying to access elements, I see that if I have a form (lets say a textarea), and I want to get the text inside of it, I must use

5条回答
  •  孤城傲影
    2020-12-10 13:57

    .val() is used to get value from input elements in jQuery. Alternative in JavaScript is .value.

    .innerHTML is used to put some value between some tags. So innerHTML is a DOM property to insert content to a specified id of an element, and with .val() you just get value from some input tags.

提交回复
热议问题